{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This is a notebook that you can use to test `itables`\n",
    "in Jupyter Lab, VS Code or PyCharm."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "from itables import init_notebook_mode\n",
    "from itables.sample_dfs import get_countries"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Make sure you try both `connected=False` (offline mode, the default, except on Google Colab)\n",
    "and `connected=True` in the below.\n",
    "\n",
    "Also, you should make sure that when the notebook is saved an reloaded (or exported to HTML)\n",
    "then the table continues to work.\n",
    "\n",
    "NB: In PyCharm, both the offline and connected mode work, however in the offline mode, the\n",
    "tables are not displayed when the notebook is reloaded.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": "/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */\n!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error(\"jQuery requires a window with a document\");return t(e)}:t(e)}(\"undefined\"!=typeof window?window:this,function(C,e){\"use strict\";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return\"function\"==typeof e&&\"number\"!=typeof e.nodeType&&\"function\"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement(\"script\");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+\"\":\"object\"==typeof e||\"function\"==typeof e?n[o.call(e)]||\"object\":typeof e}var f=\"3.6.0\",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&\"length\"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&(\"array\"===n||0===t||\"number\"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for(\"boolean\"==typeof a&&(l=a,a=arguments[s]||{},s++),\"object\"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],\"__proto__\"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:\"jQuery\"+(f+Math.random()).replace(/\\D/g,\"\"),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||\"[object Object]\"!==o.call(e))&&(!(t=r(e))||\"function\"==typeof(n=v.call(t,\"constructor\")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,\"string\"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),\"function\"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each(\"Boolean Number String Function Array Date RegExp Object Error Symbol\".split(\" \"),function(e,t){n[\"[object \"+t+\"]\"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S=\"sizzle\"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),j=function(e,t){return e===t&&(l=!0),0},D={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R=\"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",M=\"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",I=\"(?:\\\\\\\\[\\\\da-fA-F]{1,6}\"+M+\"?|\\\\\\\\[^\\\\r\\\\n\\\\f]|[\\\\w-]|[^\\0-\\\\x7f])+\",W=\"\\\\[\"+M+\"*(\"+I+\")(?:\"+M+\"*([*^$|!~]?=)\"+M+\"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\"+I+\"))|)\"+M+\"*\\\\]\",F=\":(\"+I+\")(?:\\\\((('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\"+W+\")*)|.*)\\\\)|)\",B=new RegExp(M+\"+\",\"g\"),$=new RegExp(\"^\"+M+\"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\"+M+\"+$\",\"g\"),_=new RegExp(\"^\"+M+\"*,\"+M+\"*\"),z=new RegExp(\"^\"+M+\"*([>+~]|\"+M+\")\"+M+\"*\"),U=new RegExp(M+\"|>\"),X=new RegExp(F),V=new RegExp(\"^\"+I+\"$\"),G={ID:new RegExp(\"^#(\"+I+\")\"),CLASS:new RegExp(\"^\\\\.(\"+I+\")\"),TAG:new RegExp(\"^(\"+I+\"|[*])\"),ATTR:new RegExp(\"^\"+W),PSEUDO:new RegExp(\"^\"+F),CHILD:new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\"+M+\"*(even|odd|(([+-]|)(\\\\d*)n|)\"+M+\"*(?:([+-]|)\"+M+\"*(\\\\d+)|))\"+M+\"*\\\\)|)\",\"i\"),bool:new RegExp(\"^(?:\"+R+\")$\",\"i\"),needsContext:new RegExp(\"^\"+M+\"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\"+M+\"*((?:-\\\\d)?\\\\d*)\"+M+\"*\\\\)|)(?=[^-]|$)\",\"i\")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\\d$/i,K=/^[^{]+\\{\\s*\\[native \\w/,Z=/^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,ee=/[+~]/,te=new RegExp(\"\\\\\\\\[\\\\da-fA-F]{1,6}\"+M+\"?|\\\\\\\\([^\\\\r\\\\n\\\\f])\",\"g\"),ne=function(e,t){var n=\"0x\"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\0-\\x1f\\x7f-\\uFFFF\\w-]/g,ie=function(e,t){return t?\"\\0\"===e?\"\\ufffd\":e.slice(0,-1)+\"\\\\\"+e.charCodeAt(e.length-1).toString(16)+\" \":\"\\\\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&\"fieldset\"===e.nodeName.toLowerCase()},{dir:\"parentNode\",next:\"legend\"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],\"string\"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+\" \"]&&(!v||!v.test(t))&&(1!==p||\"object\"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute(\"id\"))?s=s.replace(re,ie):e.setAttribute(\"id\",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?\"#\"+s:\":scope\")+\" \"+xe(l[o]);c=l.join(\",\")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute(\"id\")}}}return g(t.replace($,\"$1\"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+\" \")>b.cacheLength&&delete e[r.shift()],e[t+\" \"]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement(\"fieldset\");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split(\"|\"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return\"input\"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return(\"input\"===t||\"button\"===t)&&e.type===n}}function ge(t){return function(e){return\"form\"in e?e.parentNode&&!1===e.disabled?\"label\"in e?\"label\"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:\"label\"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&\"undefined\"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||\"HTML\")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener(\"unload\",oe,!1):n.attachEvent&&n.attachEvent(\"onunload\",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement(\"div\")),\"undefined\"!=typeof e.querySelectorAll&&!e.querySelectorAll(\":scope fieldset div\").length}),d.attributes=ce(function(e){return e.className=\"i\",!e.getAttribute(\"className\")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment(\"\")),!e.getElementsByTagName(\"*\").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute(\"id\")===t}},b.find.ID=function(e,t){if(\"undefined\"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t=\"undefined\"!=typeof e.getAttributeNode&&e.getAttributeNode(\"id\");return t&&t.value===n}},b.find.ID=function(e,t){if(\"undefined\"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode(\"id\"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode(\"id\"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return\"undefined\"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if(\"*\"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if(\"undefined\"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML=\"<a id='\"+S+\"'></a><select id='\"+S+\"-\\r\\\\' msallowcapture=''><option selected=''></option></select>\",e.querySelectorAll(\"[msallowcapture^='']\").length&&v.push(\"[*^$]=\"+M+\"*(?:''|\\\"\\\")\"),e.querySelectorAll(\"[selected]\").length||v.push(\"\\\\[\"+M+\"*(?:value|\"+R+\")\"),e.querySelectorAll(\"[id~=\"+S+\"-]\").length||v.push(\"~=\"),(t=C.createElement(\"input\")).setAttribute(\"name\",\"\"),e.appendChild(t),e.querySelectorAll(\"[name='']\").length||v.push(\"\\\\[\"+M+\"*name\"+M+\"*=\"+M+\"*(?:''|\\\"\\\")\"),e.querySelectorAll(\":checked\").length||v.push(\":checked\"),e.querySelectorAll(\"a#\"+S+\"+*\").length||v.push(\".#.+[+~]\"),e.querySelectorAll(\"\\\\\\f\"),v.push(\"[\\\\r\\\\n\\\\f]\")}),ce(function(e){e.innerHTML=\"<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>\";var t=C.createElement(\"input\");t.setAttribute(\"type\",\"hidden\"),e.appendChild(t).setAttribute(\"name\",\"D\"),e.querySelectorAll(\"[name=d]\").length&&v.push(\"name\"+M+\"*[*^$|!~]?=\"),2!==e.querySelectorAll(\":enabled\").length&&v.push(\":enabled\",\":disabled\"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(\":disabled\").length&&v.push(\":enabled\",\":disabled\"),e.querySelectorAll(\"*,:x\"),v.push(\",.*:\")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,\"*\"),c.call(e,\"[s!='']:x\"),s.push(\"!=\",F)}),v=v.length&&new RegExp(v.join(\"|\")),s=s.length&&new RegExp(s.join(\"|\")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+\" \"]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!=C&&T(e),y(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&D.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==r?r:d.attributes||!E?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+\"\").replace(re,ie)},se.error=function(e){throw new Error(\"Syntax error, unrecognized expression: \"+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(j),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n=\"\",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if(\"string\"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{\">\":{dir:\"parentNode\",first:!0},\" \":{dir:\"parentNode\"},\"+\":{dir:\"previousSibling\",first:!0},\"~\":{dir:\"previousSibling\"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||\"\").replace(te,ne),\"~=\"===e[2]&&(e[3]=\" \"+e[3]+\" \"),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),\"nth\"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*(\"even\"===e[3]||\"odd\"===e[3])),e[5]=+(e[7]+e[8]||\"odd\"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||\"\":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(\")\",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return\"*\"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+\" \"];return t||(t=new RegExp(\"(^|\"+M+\")\"+e+\"(\"+M+\"|$)\"))&&m(e,function(e){return t.test(\"string\"==typeof e.className&&e.className||\"undefined\"!=typeof e.getAttribute&&e.getAttribute(\"class\")||\"\")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?\"!=\"===r:!r||(t+=\"\",\"=\"===r?t===i:\"!=\"===r?t!==i:\"^=\"===r?i&&0===t.indexOf(i):\"*=\"===r?i&&-1<t.indexOf(i):\"$=\"===r?i&&t.slice(-i.length)===i:\"~=\"===r?-1<(\" \"+t.replace(B,\" \")+\" \").indexOf(i):\"|=\"===r&&(t===i||t.slice(0,i.length+1)===i+\"-\"))}},CHILD:function(h,e,t,g,v){var y=\"nth\"!==h.slice(0,3),m=\"last\"!==h.slice(-4),x=\"of-type\"===e;return 1===g&&0===v?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=y!==m?\"nextSibling\":\"previousSibling\",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(y){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l=\"only\"===h&&!u&&\"nextSibling\"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[k,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[k,d]),a===e))break;return(d-=v)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error(\"unsupported pseudo: \"+e);return a[S]?a(o):1<a.length?(t=[e,e,\"\",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:le(function(e){var r=[],i=[],s=f(e.replace($,\"$1\"));return s[S]?le(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:le(function(t){return function(e){return 0<se(t,e).length}}),contains:le(function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}}),lang:le(function(n){return V.test(n||\"\")||se.error(\"unsupported lang: \"+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=E?e.lang:e.getAttribute(\"xml:lang\")||e.getAttribute(\"lang\"))return(t=t.toLowerCase())===n||0===t.indexOf(n+\"-\")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return\"input\"===t&&!!e.checked||\"option\"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return\"input\"===t&&\"button\"===e.type||\"button\"===t},text:function(e){var t;return\"input\"===e.nodeName.toLowerCase()&&\"text\"===e.type&&(null==(t=e.getAttribute(\"type\"))||\"text\"===t.toLowerCase())},first:ve(function(){return[0]}),last:ve(function(e,t){return[t-1]}),eq:ve(function(e,t,n){return[n<0?n+t:n]}),even:ve(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ve(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ve(function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:ve(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r=\"\";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&\"parentNode\"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[k,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[S]||(e[S]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===k&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Te(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Ce(d,h,g,v,y,e){return v&&!v[S]&&(v=Ce(v)),y&&!y[S]&&(y=Ce(y,e)),le(function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(h||\"*\",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?y||(e?d:l||v)?[]:t:f;if(g&&g(f,p,n,r),v){i=Te(p,u),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(y||d){if(y){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);y(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=y?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),y?y(null,t,p,r):H.apply(t,p)})}function Ee(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[\" \"],s=o?1:0,u=be(function(e){return e===i},a,!0),l=be(function(e){return-1<P(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!==w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[be(we(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:\" \"===e[s-2].type?\"*\":\"\"})).replace($,\"$1\"),t,s<n&&Ee(e.slice(s,n)),n<r&&Ee(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+\" \"];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace($,\" \")}),a=a.slice(n.length)),b.filter)!(r=G[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,v,y,m,x,r,i=[],o=[],a=A[e+\" \"];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Ee(t[n]))[S]?i.push(a):o.push(a);(a=A(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l=\"0\",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG(\"*\",i),h=k+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==C||(T(o),n=!E);while(s=v[a++])if(s(o,t||C,n)){r.push(o);break}i&&(k=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&se.uniqueSort(r)}return i&&(k=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l=\"function\"==typeof e&&e,c=!r&&h(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&\"ID\"===(a=o[0]).type&&9===t.nodeType&&E&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(te,ne),ee.test(o[0].type)&&ye(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!E,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},d.sortStable=S.split(\"\").sort(j).join(\"\")===S,d.detectDuplicates=!!l,T(),d.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(C.createElement(\"fieldset\"))}),ce(function(e){return e.innerHTML=\"<a href='#'></a>\",\"#\"===e.firstChild.getAttribute(\"href\")})||fe(\"type|href|height|width\",function(e,t,n){if(!n)return e.getAttribute(t,\"type\"===t.toLowerCase()?1:2)}),d.attributes&&ce(function(e){return e.innerHTML=\"<input/>\",e.firstChild.setAttribute(\"value\",\"\"),\"\"===e.firstChild.getAttribute(\"value\")})||fe(\"value\",function(e,t,n){if(!n&&\"input\"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute(\"disabled\")})||fe(R,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),se}(C);S.find=d,S.expr=d.selectors,S.expr[\":\"]=S.expr.pseudos,S.uniqueSort=S.unique=d.uniqueSort,S.text=d.getText,S.isXMLDoc=d.isXML,S.contains=d.contains,S.escapeSelector=d.escape;var h=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&S(e).is(n))break;r.push(e)}return r},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=S.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var N=/^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):\"string\"!=typeof n?S.grep(e,function(e){return-1<i.call(n,e)!==r}):S.filter(n,e,r)}S.filter=function(e,t,n){var r=t[0];return n&&(e=\":not(\"+e+\")\"),1===t.length&&1===r.nodeType?S.find.matchesSelector(r,e)?[r]:[]:S.find.matches(e,S.grep(t,function(e){return 1===e.nodeType}))},S.fn.extend({find:function(e){var t,n,r=this.length,i=this;if(\"string\"!=typeof e)return this.pushStack(S(e).filter(function(){for(t=0;t<r;t++)if(S.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)S.find(e,i[t],n);return 1<r?S.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,\"string\"==typeof e&&k.test(e)?S(e):e||[],!1).length}});var D,q=/^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,\"string\"==typeof e){if(!(r=\"<\"===e[0]&&\">\"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(S.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a=\"string\"!=typeof e&&S(e);if(!k.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&S.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?S.uniqueSort(o):o)},index:function(e){return e?\"string\"==typeof e?i.call(S(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return h(e,\"parentNode\")},parentsUntil:function(e,t,n){return h(e,\"parentNode\",n)},next:function(e){return O(e,\"nextSibling\")},prev:function(e){return O(e,\"previousSibling\")},nextAll:function(e){return h(e,\"nextSibling\")},prevAll:function(e){return h(e,\"previousSibling\")},nextUntil:function(e,t,n){return h(e,\"nextSibling\",n)},prevUntil:function(e,t,n){return h(e,\"previousSibling\",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(A(e,\"template\")&&(e=e.content||e),S.merge([],e.childNodes))}},function(r,i){S.fn[r]=function(e,t){var n=S.map(this,i,e);return\"Until\"!==r.slice(-5)&&(t=e),t&&\"string\"==typeof t&&(n=S.filter(t,n)),1<this.length&&(H[r]||S.uniqueSort(n),L.test(r)&&n.reverse()),this.pushStack(n)}});var P=/[^\\x20\\t\\r\\n\\f]+/g;function R(e){return e}function M(e){throw e}function I(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}S.Callbacks=function(r){var e,n;r=\"string\"==typeof r?(e=r,n={},S.each(e.match(P)||[],function(e,t){n[t]=!0}),n):S.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:\"\")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){S.each(e,function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&\"string\"!==w(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return S.each(arguments,function(e,t){var n;while(-1<(n=S.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<S.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t=\"\",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=\"\"),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},S.extend({Deferred:function(e){var o=[[\"notify\",\"progress\",S.Callbacks(\"memory\"),S.Callbacks(\"memory\"),2],[\"resolve\",\"done\",S.Callbacks(\"once memory\"),S.Callbacks(\"once memory\"),0,\"resolved\"],[\"reject\",\"fail\",S.Callbacks(\"once memory\"),S.Callbacks(\"once memory\"),1,\"rejected\"]],i=\"pending\",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},\"catch\":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return S.Deferred(function(r){S.each(o,function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+\"With\"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError(\"Thenable self-resolution\");t=e&&(\"object\"==typeof e||\"function\"==typeof e)&&e.then,m(t)?s?t.call(e,l(u,o,R,s),l(u,o,M,s)):(u++,t.call(e,l(u,o,R,s),l(u,o,M,s),l(u,o,R,o.notifyWith))):(a!==R&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){S.Deferred.exceptionHook&&S.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==M&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(S.Deferred.getStackHook&&(t.stackTrace=S.Deferred.getStackHook()),C.setTimeout(t))}}return S.Deferred(function(e){o[0][3].add(l(0,e,m(r)?r:R,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:R)),o[2][3].add(l(0,e,m(n)?n:M))}).promise()},promise:function(e){return null!=e?S.extend(e,a):a}},s={};return S.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+\"With\"](this===s?void 0:this,arguments),this},s[t[0]+\"With\"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=s.call(arguments),o=S.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(I(e,o.done(a(t)).resolve,o.reject,!n),\"pending\"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)I(i[t],a(t),o.reject);return o.promise()}});var W=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&W.test(e.name)&&C.console.warn(\"jQuery.Deferred exception: \"+e.message,e.stack,t)},S.readyException=function(e){C.setTimeout(function(){throw e})};var F=S.Deferred();function B(){E.removeEventListener(\"DOMContentLoaded\",B),C.removeEventListener(\"load\",B),S.ready()}S.fn.ready=function(e){return F.then(e)[\"catch\"](function(e){S.readyException(e)}),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0)!==e&&0<--S.readyWait||F.resolveWith(E,[S])}}),S.ready.then=F.then,\"complete\"===E.readyState||\"loading\"!==E.readyState&&!E.documentElement.doScroll?C.setTimeout(S.ready):(E.addEventListener(\"DOMContentLoaded\",B),C.addEventListener(\"load\",B));var $=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if(\"object\"===w(n))for(s in i=!0,n)$(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(S(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},_=/^-ms-/,z=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function X(e){return e.replace(_,\"ms-\").replace(z,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=S.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if(\"string\"==typeof t)i[X(t)]=n;else for(r in t)i[X(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][X(t)]},access:function(e,t,n){return void 0===t||t&&\"string\"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(X):(t=X(t))in r?[t]:t.match(P)||[]).length;while(n--)delete r[t[n]]}(void 0===t||S.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!S.isEmptyObject(t)}};var Y=new G,Q=new G,J=/^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,K=/[A-Z]/g;function Z(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r=\"data-\"+t.replace(K,\"-$&\").toLowerCase(),\"string\"==typeof(n=e.getAttribute(r))){try{n=\"true\"===(i=n)||\"false\"!==i&&(\"null\"===i?null:i===+i+\"\"?+i:J.test(i)?JSON.parse(i):i)}catch(e){}Q.set(e,t,n)}else n=void 0;return n}S.extend({hasData:function(e){return Q.hasData(e)||Y.hasData(e)},data:function(e,t,n){return Q.access(e,t,n)},removeData:function(e,t){Q.remove(e,t)},_data:function(e,t,n){return Y.access(e,t,n)},_removeData:function(e,t){Y.remove(e,t)}}),S.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=Q.get(o),1===o.nodeType&&!Y.get(o,\"hasDataAttrs\"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf(\"data-\")&&(r=X(r.slice(5)),Z(o,r,i[r]));Y.set(o,\"hasDataAttrs\",!0)}return i}return\"object\"==typeof n?this.each(function(){Q.set(this,n)}):$(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=Q.get(o,n))?t:void 0!==(t=Z(o,n))?t:void 0;this.each(function(){Q.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){Q.remove(this,e)})}}),S.extend({queue:function(e,t,n){var r;if(e)return t=(t||\"fx\")+\"queue\",r=Y.get(e,t),n&&(!r||Array.isArray(n)?r=Y.access(e,t,S.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||\"fx\";var n=S.queue(e,t),r=n.length,i=n.shift(),o=S._queueHooks(e,t);\"inprogress\"===i&&(i=n.shift(),r--),i&&(\"fx\"===t&&n.unshift(\"inprogress\"),delete o.stop,i.call(e,function(){S.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+\"queueHooks\";return Y.get(e,n)||Y.access(e,n,{empty:S.Callbacks(\"once memory\").add(function(){Y.remove(e,[t+\"queue\",n])})})}}),S.fn.extend({queue:function(t,n){var e=2;return\"string\"!=typeof t&&(n=t,t=\"fx\",e--),arguments.length<e?S.queue(this[0],t):void 0===n?this:this.each(function(){var e=S.queue(this,t,n);S._queueHooks(this,t),\"fx\"===t&&\"inprogress\"!==e[0]&&S.dequeue(this,t)})},dequeue:function(e){return this.each(function(){S.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||\"fx\",[])},promise:function(e,t){var n,r=1,i=S.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};\"string\"!=typeof e&&(t=e,e=void 0),e=e||\"fx\";while(a--)(n=Y.get(o[a],e+\"queueHooks\"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source,te=new RegExp(\"^(?:([+-])=|)(\"+ee+\")([a-z%]*)$\",\"i\"),ne=[\"Top\",\"Right\",\"Bottom\",\"Left\"],re=E.documentElement,ie=function(e){return S.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return S.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return\"none\"===(e=t||e).style.display||\"\"===e.style.display&&ie(e)&&\"none\"===S.css(e,\"display\")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return S.css(e,t,\"\")},u=s(),l=n&&n[3]||(S.cssNumber[t]?\"\":\"px\"),c=e.nodeType&&(S.cssNumber[t]||\"px\"!==l&&+u)&&te.exec(S.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)S.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,S.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ue={};function le(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?(\"none\"===n&&(l[c]=Y.get(r,\"display\")||null,l[c]||(r.style.display=\"\")),\"\"===r.style.display&&ae(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ue[s])||(o=a.body.appendChild(a.createElement(s)),u=S.css(o,\"display\"),o.parentNode.removeChild(o),\"none\"===u&&(u=\"block\"),ue[s]=u)))):\"none\"!==n&&(l[c]=\"none\",Y.set(r,\"display\",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}S.fn.extend({show:function(){return le(this,!0)},hide:function(){return le(this)},toggle:function(e){return\"boolean\"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?S(this).show():S(this).hide()})}});var ce,fe,pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)/i,he=/^$|^module$|\\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement(\"div\")),(fe=E.createElement(\"input\")).setAttribute(\"type\",\"radio\"),fe.setAttribute(\"checked\",\"checked\"),fe.setAttribute(\"name\",\"t\"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML=\"<textarea>x</textarea>\",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML=\"<option></option>\",y.option=!!ce.lastChild;var ge={thead:[1,\"<table>\",\"</table>\"],col:[2,\"<table><colgroup>\",\"</colgroup></table>\"],tr:[2,\"<table><tbody>\",\"</tbody></table>\"],td:[3,\"<table><tbody><tr>\",\"</tr></tbody></table>\"],_default:[0,\"\",\"\"]};function ve(e,t){var n;return n=\"undefined\"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||\"*\"):\"undefined\"!=typeof e.querySelectorAll?e.querySelectorAll(t||\"*\"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)Y.set(e[n],\"globalEval\",!t||Y.get(t[n],\"globalEval\"))}ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,y.option||(ge.optgroup=ge.option=[1,\"<select multiple='multiple'>\",\"</select>\"]);var me=/<|&#?\\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if(\"object\"===w(o))S.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement(\"div\")),s=(de.exec(o)||[\"\",\"\"])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+S.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;S.merge(p,a.childNodes),(a=f.firstChild).textContent=\"\"}else p.push(t.createTextNode(o));f.textContent=\"\",d=0;while(o=p[d++])if(r&&-1<S.inArray(o,r))i&&i.push(o);else if(l=ie(o),a=ve(f.appendChild(o),\"script\"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||\"\")&&n.push(o)}return f}var be=/^([^.]*)(?:\\.(.+)|)/;function we(){return!0}function Te(){return!1}function Ce(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==(\"focus\"===t)}function Ee(e,t,n,r,i,o){var a,s;if(\"object\"==typeof t){for(s in\"string\"!=typeof n&&(r=r||n,n=void 0),t)Ee(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&(\"string\"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Te;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,i,r,n)})}function Se(e,i,o){o?(Y.set(e,i,!1),S.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(S.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n&&n.value}else r.length&&(Y.set(this,i,{value:S.event.trigger(S.extend(r[0],S.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,i)&&S.event.add(e,i,we)}S.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.get(t);if(V(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&S.find.matchesSelector(re,i),n.guid||(n.guid=S.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return\"undefined\"!=typeof S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||\"\").match(P)||[\"\"]).length;while(l--)d=g=(s=be.exec(e[l])||[])[1],h=(s[2]||\"\").split(\".\").sort(),d&&(f=S.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=S.event.special[d]||{},c=S.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&S.expr.match.needsContext.test(i),namespace:h.join(\".\")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),S.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.hasData(e)&&Y.get(e);if(v&&(u=v.events)){l=(t=(t||\"\").match(P)||[\"\"]).length;while(l--)if(d=g=(s=be.exec(t[l])||[])[1],h=(s[2]||\"\").split(\".\").sort(),d){f=S.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp(\"(^|\\\\.)\"+h.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&(\"**\"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||S.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)S.event.remove(e,d+t[l],n,r,!0);S.isEmptyObject(u)&&Y.remove(e,\"handle events\")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=S.event.fix(e),l=(Y.get(this,\"events\")||Object.create(null))[u.type]||[],c=S.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=S.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((S.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!(\"click\"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&(\"click\"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+\" \"]&&(a[i]=r.needsContext?-1<S(i,this).index(l):S.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(S.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[S.expando]?e:new S.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,\"input\")&&Se(t,\"click\",we),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,\"input\")&&Se(t,\"click\"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,\"input\")&&Y.get(t,\"click\")||A(t,\"a\")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},S.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},S.Event=function(e,t){if(!(this instanceof S.Event))return new S.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?we:Te,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&S.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[S.expando]=!0},S.Event.prototype={constructor:S.Event,isDefaultPrevented:Te,isPropagationStopped:Te,isImmediatePropagationStopped:Te,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=we,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=we,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=we,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},S.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,\"char\":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:!0},S.event.addProp),S.each({focus:\"focusin\",blur:\"focusout\"},function(e,t){S.event.special[e]={setup:function(){return Se(this,e,Ce),!1},trigger:function(){return Se(this,e),!0},_default:function(){return!0},delegateType:t}}),S.each({mouseenter:\"mouseover\",mouseleave:\"mouseout\",pointerenter:\"pointerover\",pointerleave:\"pointerout\"},function(e,i){S.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||S.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),S.fn.extend({on:function(e,t,n,r){return Ee(this,e,t,n,r)},one:function(e,t,n,r){return Ee(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,S(e.delegateTarget).off(r.namespace?r.origType+\".\"+r.namespace:r.origType,r.selector,r.handler),this;if(\"object\"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&\"function\"!=typeof t||(n=t,t=void 0),!1===n&&(n=Te),this.each(function(){S.event.remove(this,e,n,t)})}});var ke=/<script|<style|<link/i,Ae=/checked\\s*(?:[^=]|=\\s*.checked.)/i,Ne=/^\\s*<!(?:\\[CDATA\\[|--)|(?:\\]\\]|--)>\\s*$/g;function je(e,t){return A(e,\"table\")&&A(11!==t.nodeType?t:t.firstChild,\"tr\")&&S(e).children(\"tbody\")[0]||e}function De(e){return e.type=(null!==e.getAttribute(\"type\"))+\"/\"+e.type,e}function qe(e){return\"true/\"===(e.type||\"\").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute(\"type\"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,\"handle events\"),s)for(n=0,r=s[i].length;n<r;n++)S.event.add(t,i,s[i][n]);Q.hasData(e)&&(o=Q.access(e),a=S.extend({},o),Q.set(t,a))}}function He(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=m(d);if(h||1<f&&\"string\"==typeof d&&!y.checkClone&&Ae.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),He(t,r,i,o)});if(f&&(t=(e=xe(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=S.map(ve(e,\"script\"),De)).length;c<f;c++)u=e,c!==p&&(u=S.clone(u,!0,!0),s&&S.merge(a,ve(u,\"script\"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,S.map(a,qe),c=0;c<s;c++)u=a[c],he.test(u.type||\"\")&&!Y.access(u,\"globalEval\")&&S.contains(l,u)&&(u.src&&\"module\"!==(u.type||\"\").toLowerCase()?S._evalUrl&&!u.noModule&&S._evalUrl(u.src,{nonce:u.nonce||u.getAttribute(\"nonce\")},l):b(u.textContent.replace(Ne,\"\"),u,l))}return n}function Oe(e,t,n){for(var r,i=t?S.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||S.cleanData(ve(r)),r.parentNode&&(n&&ie(r)&&ye(ve(r,\"script\")),r.parentNode.removeChild(r));return e}S.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=ie(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r<i;r++)s=o[r],u=a[r],void 0,\"input\"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:\"input\"!==l&&\"textarea\"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ve(e),a=a||ve(c),r=0,i=o.length;r<i;r++)Le(o[r],a[r]);else Le(e,c);return 0<(a=ve(c,\"script\")).length&&ye(a,!f&&ve(e,\"script\")),c},cleanData:function(e){for(var t,n,r,i=S.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?S.event.remove(n,r):S.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),S.fn.extend({detach:function(e){return Oe(this,e,!0)},remove:function(e){return Oe(this,e)},text:function(e){return $(this,function(e){return void 0===e?S.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return He(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||je(this,e).appendChild(e)})},prepend:function(){return He(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=je(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return He(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(S.cleanData(ve(e,!1)),e.textContent=\"\");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return S.clone(this,e,t)})},html:function(e){return $(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if(\"string\"==typeof e&&!ke.test(e)&&!ge[(de.exec(e)||[\"\",\"\"])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(S.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return He(this,arguments,function(e){var t=this.parentNode;S.inArray(this,n)<0&&(S.cleanData(ve(this)),t&&t.replaceChild(e,this))},n)}}),S.each({appendTo:\"append\",prependTo:\"prepend\",insertBefore:\"before\",insertAfter:\"after\",replaceAll:\"replaceWith\"},function(e,a){S.fn[e]=function(e){for(var t,n=[],r=S(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),S(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}});var Pe=new RegExp(\"^(\"+ee+\")(?!px)[a-z%]+$\",\"i\"),Re=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},Me=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Ie=new RegExp(ne.join(\"|\"),\"i\");function We(e,t,n){var r,i,o,a,s=e.style;return(n=n||Re(e))&&(\"\"!==(a=n.getPropertyValue(t)||n[t])||ie(e)||(a=S.style(e,t)),!y.pixelBoxStyles()&&Pe.test(a)&&Ie.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+\"\":a}function Fe(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText=\"position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0\",l.style.cssText=\"position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%\",re.appendChild(u).appendChild(l);var e=C.getComputedStyle(l);n=\"1%\"!==e.top,s=12===t(e.marginLeft),l.style.right=\"60%\",o=36===t(e.right),r=36===t(e.width),l.style.position=\"absolute\",i=12===t(l.offsetWidth/3),re.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=E.createElement(\"div\"),l=E.createElement(\"div\");l.style&&(l.style.backgroundClip=\"content-box\",l.cloneNode(!0).style.backgroundClip=\"\",y.clearCloneStyle=\"content-box\"===l.style.backgroundClip,S.extend(y,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=E.createElement(\"table\"),t=E.createElement(\"tr\"),n=E.createElement(\"div\"),e.style.cssText=\"position:absolute;left:-11111px;border-collapse:separate\",t.style.cssText=\"border:1px solid\",t.style.height=\"1px\",n.style.height=\"9px\",n.style.display=\"block\",re.appendChild(e).appendChild(t).appendChild(n),r=C.getComputedStyle(t),a=parseInt(r.height,10)+parseInt(r.borderTopWidth,10)+parseInt(r.borderBottomWidth,10)===t.offsetHeight,re.removeChild(e)),a}}))}();var Be=[\"Webkit\",\"Moz\",\"ms\"],$e=E.createElement(\"div\").style,_e={};function ze(e){var t=S.cssProps[e]||_e[e];return t||(e in $e?e:_e[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=Be.length;while(n--)if((e=Be[n]+t)in $e)return e}(e)||e)}var Ue=/^(none|table(?!-c[ea]).+)/,Xe=/^--/,Ve={position:\"absolute\",visibility:\"hidden\",display:\"block\"},Ge={letterSpacing:\"0\",fontWeight:\"400\"};function Ye(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||\"px\"):t}function Qe(e,t,n,r,i,o){var a=\"width\"===t?1:0,s=0,u=0;if(n===(r?\"border\":\"content\"))return 0;for(;a<4;a+=2)\"margin\"===n&&(u+=S.css(e,n+ne[a],!0,i)),r?(\"content\"===n&&(u-=S.css(e,\"padding\"+ne[a],!0,i)),\"margin\"!==n&&(u-=S.css(e,\"border\"+ne[a]+\"Width\",!0,i))):(u+=S.css(e,\"padding\"+ne[a],!0,i),\"padding\"!==n?u+=S.css(e,\"border\"+ne[a]+\"Width\",!0,i):s+=S.css(e,\"border\"+ne[a]+\"Width\",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e[\"offset\"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function Je(e,t,n){var r=Re(e),i=(!y.boxSizingReliable()||n)&&\"border-box\"===S.css(e,\"boxSizing\",!1,r),o=i,a=We(e,t,r),s=\"offset\"+t[0].toUpperCase()+t.slice(1);if(Pe.test(a)){if(!n)return a;a=\"auto\"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&A(e,\"tr\")||\"auto\"===a||!parseFloat(a)&&\"inline\"===S.css(e,\"display\",!1,r))&&e.getClientRects().length&&(i=\"border-box\"===S.css(e,\"boxSizing\",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Qe(e,t,n||(i?\"border\":\"content\"),o,r,a)+\"px\"}function Ke(e,t,n,r,i){return new Ke.prototype.init(e,t,n,r,i)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=We(e,\"opacity\");return\"\"===n?\"1\":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),u=Xe.test(t),l=e.style;if(u||(t=ze(s)),a=S.cssHooks[t]||S.cssHooks[s],void 0===n)return a&&\"get\"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];\"string\"===(o=typeof n)&&(i=te.exec(n))&&i[1]&&(n=se(e,t,i),o=\"number\"),null!=n&&n==n&&(\"number\"!==o||u||(n+=i&&i[3]||(S.cssNumber[s]?\"\":\"px\")),y.clearCloneStyle||\"\"!==n||0!==t.indexOf(\"background\")||(l[t]=\"inherit\"),a&&\"set\"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=X(t);return Xe.test(t)||(t=ze(s)),(a=S.cssHooks[t]||S.cssHooks[s])&&\"get\"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=We(e,t,r)),\"normal\"===i&&t in Ge&&(i=Ge[t]),\"\"===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),S.each([\"height\",\"width\"],function(e,u){S.cssHooks[u]={get:function(e,t,n){if(t)return!Ue.test(S.css(e,\"display\"))||e.getClientRects().length&&e.getBoundingClientRect().width?Je(e,u,n):Me(e,Ve,function(){return Je(e,u,n)})},set:function(e,t,n){var r,i=Re(e),o=!y.scrollboxSize()&&\"absolute\"===i.position,a=(o||n)&&\"border-box\"===S.css(e,\"boxSizing\",!1,i),s=n?Qe(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e[\"offset\"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-Qe(e,u,\"border\",!1,i)-.5)),s&&(r=te.exec(t))&&\"px\"!==(r[3]||\"px\")&&(e.style[u]=t,t=S.css(e,u)),Ye(0,t,s)}}}),S.cssHooks.marginLeft=Fe(y.reliableMarginLeft,function(e,t){if(t)return(parseFloat(We(e,\"marginLeft\"))||e.getBoundingClientRect().left-Me(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+\"px\"}),S.each({margin:\"\",padding:\"\",border:\"Width\"},function(i,o){S.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r=\"string\"==typeof e?e.split(\" \"):[e];t<4;t++)n[i+ne[t]+o]=r[t]||r[t-2]||r[0];return n}},\"margin\"!==i&&(S.cssHooks[i+o].set=Ye)}),S.fn.extend({css:function(e,t){return $(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Re(e),i=t.length;a<i;a++)o[t[a]]=S.css(e,t[a],!1,r);return o}return void 0!==n?S.style(e,t,n):S.css(e,t)},e,t,1<arguments.length)}}),((S.Tween=Ke).prototype={constructor:Ke,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?\"\":\"px\")},cur:function(){var e=Ke.propHooks[this.prop];return e&&e.get?e.get(this):Ke.propHooks._default.get(this)},run:function(e){var t,n=Ke.propHooks[this.prop];return this.options.duration?this.pos=t=S.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Ke.propHooks._default.set(this),this}}).init.prototype=Ke.prototype,(Ke.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=S.css(e.elem,e.prop,\"\"))&&\"auto\"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||!S.cssHooks[e.prop]&&null==e.elem.style[ze(e.prop)]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=Ke.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:\"swing\"},S.fx=Ke.prototype.init,S.fx.step={};var Ze,et,tt,nt,rt=/^(?:toggle|show|hide)$/,it=/queueHooks$/;function ot(){et&&(!1===E.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(ot):C.setTimeout(ot,S.fx.interval),S.fx.tick())}function at(){return C.setTimeout(function(){Ze=void 0}),Ze=Date.now()}function st(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i[\"margin\"+(n=ne[r])]=i[\"padding\"+n]=e;return t&&(i.opacity=i.width=e),i}function ut(e,t,n){for(var r,i=(lt.tweeners[t]||[]).concat(lt.tweeners[\"*\"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function lt(o,e,t){var n,a,r=0,i=lt.prefilters.length,s=S.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=Ze||at(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:S.extend({},e),opts:S.extend(!0,{specialEasing:{},easing:S.easing._default},t),originalProperties:e,originalOptions:t,startTime:Ze||at(),duration:t.duration,tweens:[],createTween:function(e,t){var n=S.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=X(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=S.cssHooks[r])&&\"expand\"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=lt.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(S._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return S.map(c,ut,l),m(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),S.fx.timer(S.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}S.Animation=S.extend(lt,{tweeners:{\"*\":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=[\"*\"]):e=e.match(P);for(var n,r=0,i=e.length;r<i;r++)n=e[r],lt.tweeners[n]=lt.tweeners[n]||[],lt.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f=\"width\"in t||\"height\"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),v=Y.get(e,\"fxshow\");for(r in n.queue||(null==(a=S._queueHooks(e,\"fx\")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,S.queue(e,\"fx\").length||a.empty.fire()})})),t)if(i=t[r],rt.test(i)){if(delete t[r],o=o||\"toggle\"===i,i===(g?\"hide\":\"show\")){if(\"show\"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||S.style(e,r)}if((u=!S.isEmptyObject(t))||!S.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=Y.get(e,\"display\")),\"none\"===(c=S.css(e,\"display\"))&&(l?c=l:(le([e],!0),l=e.style.display||l,c=S.css(e,\"display\"),le([e]))),(\"inline\"===c||\"inline-block\"===c&&null!=l)&&\"none\"===S.css(e,\"float\")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l=\"none\"===c?\"\":c)),h.display=\"inline-block\")),n.overflow&&(h.overflow=\"hidden\",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?\"hidden\"in v&&(g=v.hidden):v=Y.access(e,\"fxshow\",{display:l}),o&&(v.hidden=!g),g&&le([e],!0),p.done(function(){for(r in g||le([e]),Y.remove(e,\"fxshow\"),d)S.style(e,r,d[r])})),u=ut(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?lt.prefilters.unshift(e):lt.prefilters.push(e)}}),S.speed=function(e,t,n){var r=e&&\"object\"==typeof e?S.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return S.fx.off?r.duration=0:\"number\"!=typeof r.duration&&(r.duration in S.fx.speeds?r.duration=S.fx.speeds[r.duration]:r.duration=S.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue=\"fx\"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&S.dequeue(this,r.queue)},r},S.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css(\"opacity\",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=S.isEmptyObject(t),o=S.speed(e,n,r),a=function(){var e=lt(this,S.extend({},t),o);(i||Y.get(this,\"finish\"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return\"string\"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||\"fx\",[]),this.each(function(){var e=!0,t=null!=i&&i+\"queueHooks\",n=S.timers,r=Y.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&it.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||S.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||\"fx\"),this.each(function(){var e,t=Y.get(this),n=t[a+\"queue\"],r=t[a+\"queueHooks\"],i=S.timers,o=n?n.length:0;for(t.finish=!0,S.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),S.each([\"toggle\",\"show\",\"hide\"],function(e,r){var i=S.fn[r];S.fn[r]=function(e,t,n){return null==e||\"boolean\"==typeof e?i.apply(this,arguments):this.animate(st(r,!0),e,t,n)}}),S.each({slideDown:st(\"show\"),slideUp:st(\"hide\"),slideToggle:st(\"toggle\"),fadeIn:{opacity:\"show\"},fadeOut:{opacity:\"hide\"},fadeToggle:{opacity:\"toggle\"}},function(e,r){S.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),S.timers=[],S.fx.tick=function(){var e,t=0,n=S.timers;for(Ze=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||S.fx.stop(),Ze=void 0},S.fx.timer=function(e){S.timers.push(e),S.fx.start()},S.fx.interval=13,S.fx.start=function(){et||(et=!0,ot())},S.fx.stop=function(){et=null},S.fx.speeds={slow:600,fast:200,_default:400},S.fn.delay=function(r,e){return r=S.fx&&S.fx.speeds[r]||r,e=e||\"fx\",this.queue(e,function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}})},tt=E.createElement(\"input\"),nt=E.createElement(\"select\").appendChild(E.createElement(\"option\")),tt.type=\"checkbox\",y.checkOn=\"\"!==tt.value,y.optSelected=nt.selected,(tt=E.createElement(\"input\")).value=\"t\",tt.type=\"radio\",y.radioValue=\"t\"===tt.value;var ct,ft=S.expr.attrHandle;S.fn.extend({attr:function(e,t){return $(this,S.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){S.removeAttr(this,e)})}}),S.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return\"undefined\"==typeof e.getAttribute?S.prop(e,t,n):(1===o&&S.isXMLDoc(e)||(i=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?ct:void 0)),void 0!==n?null===n?void S.removeAttr(e,t):i&&\"set\"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+\"\"),n):i&&\"get\"in i&&null!==(r=i.get(e,t))?r:null==(r=S.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&\"radio\"===t&&A(e,\"input\")){var n=e.value;return e.setAttribute(\"type\",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(P);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),ct={set:function(e,t,n){return!1===t?S.removeAttr(e,n):e.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\\w+/g),function(e,t){var a=ft[t]||S.find.attr;ft[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=ft[o],ft[o]=r,r=null!=a(e,t,n)?o:null,ft[o]=i),r}});var pt=/^(?:input|select|textarea|button)$/i,dt=/^(?:a|area)$/i;function ht(e){return(e.match(P)||[]).join(\" \")}function gt(e){return e.getAttribute&&e.getAttribute(\"class\")||\"\"}function vt(e){return Array.isArray(e)?e:\"string\"==typeof e&&e.match(P)||[]}S.fn.extend({prop:function(e,t){return $(this,S.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[S.propFix[e]||e]})}}),S.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&S.isXMLDoc(e)||(t=S.propFix[t]||t,i=S.propHooks[t]),void 0!==n?i&&\"set\"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&\"get\"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=S.find.attr(e,\"tabindex\");return t?parseInt(t,10):pt.test(e.nodeName)||dt.test(e.nodeName)&&e.href?0:-1}}},propFix:{\"for\":\"htmlFor\",\"class\":\"className\"}}),y.optSelected||(S.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),S.each([\"tabIndex\",\"readOnly\",\"maxLength\",\"cellSpacing\",\"cellPadding\",\"rowSpan\",\"colSpan\",\"useMap\",\"frameBorder\",\"contentEditable\"],function(){S.propFix[this.toLowerCase()]=this}),S.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).addClass(t.call(this,e,gt(this)))});if((e=vt(t)).length)while(n=this[u++])if(i=gt(n),r=1===n.nodeType&&\" \"+ht(i)+\" \"){a=0;while(o=e[a++])r.indexOf(\" \"+o+\" \")<0&&(r+=o+\" \");i!==(s=ht(r))&&n.setAttribute(\"class\",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).removeClass(t.call(this,e,gt(this)))});if(!arguments.length)return this.attr(\"class\",\"\");if((e=vt(t)).length)while(n=this[u++])if(i=gt(n),r=1===n.nodeType&&\" \"+ht(i)+\" \"){a=0;while(o=e[a++])while(-1<r.indexOf(\" \"+o+\" \"))r=r.replace(\" \"+o+\" \",\" \");i!==(s=ht(r))&&n.setAttribute(\"class\",s)}return this},toggleClass:function(i,t){var o=typeof i,a=\"string\"===o||Array.isArray(i);return\"boolean\"==typeof t&&a?t?this.addClass(i):this.removeClass(i):m(i)?this.each(function(e){S(this).toggleClass(i.call(this,e,gt(this),t),t)}):this.each(function(){var e,t,n,r;if(a){t=0,n=S(this),r=vt(i);while(e=r[t++])n.hasClass(e)?n.removeClass(e):n.addClass(e)}else void 0!==i&&\"boolean\"!==o||((e=gt(this))&&Y.set(this,\"__className__\",e),this.setAttribute&&this.setAttribute(\"class\",e||!1===i?\"\":Y.get(this,\"__className__\")||\"\"))})},hasClass:function(e){var t,n,r=0;t=\" \"+e+\" \";while(n=this[r++])if(1===n.nodeType&&-1<(\" \"+ht(gt(n))+\" \").indexOf(t))return!0;return!1}});var yt=/\\r/g;S.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,S(this).val()):n)?t=\"\":\"number\"==typeof t?t+=\"\":Array.isArray(t)&&(t=S.map(t,function(e){return null==e?\"\":e+\"\"})),(r=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&\"set\"in r&&void 0!==r.set(this,t,\"value\")||(this.value=t))})):t?(r=S.valHooks[t.type]||S.valHooks[t.nodeName.toLowerCase()])&&\"get\"in r&&void 0!==(e=r.get(t,\"value\"))?e:\"string\"==typeof(e=t.value)?e.replace(yt,\"\"):null==e?\"\":e:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,\"value\");return null!=t?t:ht(S.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a=\"select-one\"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,\"optgroup\"))){if(t=S(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=S.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<S.inArray(S.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),S.each([\"radio\",\"checkbox\"],function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<S.inArray(S(e).val(),t)}},y.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute(\"value\")?\"on\":e.value})}),y.focusin=\"onfocusin\"in C;var mt=/^(?:focusinfocus|focusoutblur)$/,xt=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||E],d=v.call(e,\"type\")?e.type:e,h=v.call(e,\"namespace\")?e.namespace.split(\".\"):[];if(o=f=a=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!mt.test(d+S.event.triggered)&&(-1<d.indexOf(\".\")&&(d=(h=d.split(\".\")).shift(),h.sort()),u=d.indexOf(\":\")<0&&\"on\"+d,(e=e[S.expando]?e:new S.Event(d,\"object\"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join(\".\"),e.rnamespace=e.namespace?new RegExp(\"(^|\\\\.)\"+h.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:S.makeArray(t,[e]),c=S.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,mt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||E)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Y.get(o,\"events\")||Object.create(null))[e.type]&&Y.get(o,\"handle\"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&V(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!V(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),S.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,xt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,xt),S.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=S.extend(new S.Event,n,{type:e,isSimulated:!0});S.event.trigger(r,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each(function(){S.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return S.event.trigger(e,t,n,!0)}}),y.focusin||S.each({focus:\"focusin\",blur:\"focusout\"},function(n,r){var i=function(e){S.event.simulate(r,e.target,S.event.fix(e))};S.event.special[r]={setup:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r);t||e.addEventListener(n,i,!0),Y.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r)-1;t?Y.access(e,r,t):(e.removeEventListener(n,i,!0),Y.remove(e,r))}}});var bt=C.location,wt={guid:Date.now()},Tt=/\\?/;S.parseXML=function(e){var t,n;if(!e||\"string\"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,\"text/xml\")}catch(e){}return n=t&&t.getElementsByTagName(\"parsererror\")[0],t&&!n||S.error(\"Invalid XML: \"+(n?S.map(n.childNodes,function(e){return e.textContent}).join(\"\\n\"):e)),t};var Ct=/\\[\\]$/,Et=/\\r?\\n/g,St=/^(?:submit|button|image|reset|file)$/i,kt=/^(?:input|select|textarea|keygen)/i;function At(n,e,r,i){var t;if(Array.isArray(e))S.each(e,function(e,t){r||Ct.test(n)?i(n,t):At(n+\"[\"+(\"object\"==typeof t&&null!=t?e:\"\")+\"]\",t,r,i)});else if(r||\"object\"!==w(e))i(n,e);else for(t in e)At(n+\"[\"+t+\"]\",e[t],r,i)}S.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+\"=\"+encodeURIComponent(null==n?\"\":n)};if(null==e)return\"\";if(Array.isArray(e)||e.jquery&&!S.isPlainObject(e))S.each(e,function(){i(this.name,this.value)});else for(n in e)At(n,e[n],t,i);return r.join(\"&\")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=S.prop(this,\"elements\");return e?S.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!S(this).is(\":disabled\")&&kt.test(this.nodeName)&&!St.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,function(e){return{name:t.name,value:e.replace(Et,\"\\r\\n\")}}):{name:t.name,value:n.replace(Et,\"\\r\\n\")}}).get()}});var Nt=/%20/g,jt=/#.*$/,Dt=/([?&])_=[^&]*/,qt=/^(.*?):[ \\t]*([^\\r\\n]*)$/gm,Lt=/^(?:GET|HEAD)$/,Ht=/^\\/\\//,Ot={},Pt={},Rt=\"*/\".concat(\"*\"),Mt=E.createElement(\"a\");function It(o){return function(e,t){\"string\"!=typeof e&&(t=e,e=\"*\");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])\"+\"===n[0]?(n=n.slice(1)||\"*\",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Wt(t,i,o,a){var s={},u=t===Pt;function l(e){var r;return s[e]=!0,S.each(t[e]||[],function(e,t){var n=t(i,o,a);return\"string\"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s[\"*\"]&&l(\"*\")}function Ft(e,t){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&S.extend(!0,e,r),e}Mt.href=bt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:bt.href,type:\"GET\",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(bt.protocol),global:!0,processData:!0,async:!0,contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",accepts:{\"*\":Rt,text:\"text/plain\",html:\"text/html\",xml:\"application/xml, text/xml\",json:\"application/json, text/javascript\"},contents:{xml:/\\bxml\\b/,html:/\\bhtml/,json:/\\bjson\\b/},responseFields:{xml:\"responseXML\",text:\"responseText\",json:\"responseJSON\"},converters:{\"* text\":String,\"text html\":!0,\"text json\":JSON.parse,\"text xml\":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Ft(Ft(e,S.ajaxSettings),t):Ft(S.ajaxSettings,e)},ajaxPrefilter:It(Ot),ajaxTransport:It(Pt),ajax:function(e,t){\"object\"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=S.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?S(y):S.event,x=S.Deferred(),b=S.Callbacks(\"once memory\"),w=v.statusCode||{},a={},s={},u=\"canceled\",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=qt.exec(p))n[t[1].toLowerCase()+\" \"]=(n[t[1].toLowerCase()+\" \"]||[]).concat(t[2])}t=n[e.toLowerCase()+\" \"]}return null==t?null:t.join(\", \")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||bt.href)+\"\").replace(Ht,bt.protocol+\"//\"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||\"*\").toLowerCase().match(P)||[\"\"],null==v.crossDomain){r=E.createElement(\"a\");try{r.href=v.url,r.href=r.href,v.crossDomain=Mt.protocol+\"//\"+Mt.host!=r.protocol+\"//\"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&\"string\"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Wt(Ot,v,t,T),h)return T;for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger(\"ajaxStart\"),v.type=v.type.toUpperCase(),v.hasContent=!Lt.test(v.type),f=v.url.replace(jt,\"\"),v.hasContent?v.data&&v.processData&&0===(v.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&(v.data=v.data.replace(Nt,\"+\")):(o=v.url.slice(f.length),v.data&&(v.processData||\"string\"==typeof v.data)&&(f+=(Tt.test(f)?\"&\":\"?\")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Dt,\"$1\"),o=(Tt.test(f)?\"&\":\"?\")+\"_=\"+wt.guid+++o),v.url=f+o),v.ifModified&&(S.lastModified[f]&&T.setRequestHeader(\"If-Modified-Since\",S.lastModified[f]),S.etag[f]&&T.setRequestHeader(\"If-None-Match\",S.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader(\"Content-Type\",v.contentType),T.setRequestHeader(\"Accept\",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+(\"*\"!==v.dataTypes[0]?\", \"+Rt+\"; q=0.01\":\"\"):v.accepts[\"*\"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u=\"abort\",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Wt(Pt,v,t,T)){if(T.readyState=1,g&&m.trigger(\"ajaxSend\",[T,v]),h)return T;v.async&&0<v.timeout&&(d=C.setTimeout(function(){T.abort(\"timeout\")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,\"No Transport\");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&C.clearTimeout(d),c=void 0,p=r||\"\",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while(\"*\"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader(\"Content-Type\"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+\" \"+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<S.inArray(\"script\",v.dataTypes)&&S.inArray(\"json\",v.dataTypes)<0&&(v.converters[\"text script\"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if(\"*\"===o)o=u;else if(\"*\"!==u&&u!==o){if(!(a=l[u+\" \"+o]||l[\"* \"+o]))for(i in l)if((s=i.split(\" \"))[1]===o&&(a=l[u+\" \"+s[0]]||l[\"* \"+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e[\"throws\"])t=a(t);else try{t=a(t)}catch(e){return{state:\"parsererror\",error:a?e:\"No conversion from \"+u+\" to \"+o}}}return{state:\"success\",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader(\"Last-Modified\"))&&(S.lastModified[f]=u),(u=T.getResponseHeader(\"etag\"))&&(S.etag[f]=u)),204===e||\"HEAD\"===v.type?l=\"nocontent\":304===e?l=\"notmodified\":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l=\"error\",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+\"\",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?\"ajaxSuccess\":\"ajaxError\",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger(\"ajaxComplete\",[T,v]),--S.active||S.event.trigger(\"ajaxStop\")))}return T},getJSON:function(e,t,n){return S.get(e,t,n,\"json\")},getScript:function(e,t){return S.get(e,void 0,t,\"script\")}}),S.each([\"get\",\"post\"],function(e,i){S[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),S.ajax(S.extend({url:e,type:i,dataType:r,data:t,success:n},S.isPlainObject(e)&&e))}}),S.ajaxPrefilter(function(e){var t;for(t in e.headers)\"content-type\"===t.toLowerCase()&&(e.contentType=e.headers[t]||\"\")}),S._evalUrl=function(e,t,n){return S.ajax({url:e,type:\"GET\",dataType:\"script\",cache:!0,async:!1,global:!1,converters:{\"text script\":function(){}},dataFilter:function(e){S.globalEval(e,t,n)}})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=S(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return m(n)?this.each(function(e){S(this).wrapInner(n.call(this,e))}):this.each(function(){var e=S(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=m(t);return this.each(function(e){S(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not(\"body\").each(function(){S(this).replaceWith(this.childNodes)}),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var Bt={0:200,1223:204},$t=S.ajaxSettings.xhr();y.cors=!!$t&&\"withCredentials\"in $t,y.ajax=$t=!!$t,S.ajaxTransport(function(i){var o,a;if(y.cors||$t&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e[\"X-Requested-With\"]||(e[\"X-Requested-With\"]=\"XMLHttpRequest\"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,\"abort\"===e?r.abort():\"error\"===e?\"number\"!=typeof r.status?t(0,\"error\"):t(r.status,r.statusText):t(Bt[r.status]||r.status,r.statusText,\"text\"!==(r.responseType||\"text\")||\"string\"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o(\"error\"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&C.setTimeout(function(){o&&a()})},o=o(\"abort\");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),S.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),S.ajaxSetup({accepts:{script:\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"},contents:{script:/\\b(?:java|ecma)script\\b/},converters:{\"text script\":function(e){return S.globalEval(e),e}}}),S.ajaxPrefilter(\"script\",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type=\"GET\")}),S.ajaxTransport(\"script\",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=S(\"<script>\").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on(\"load error\",i=function(e){r.remove(),i=null,e&&t(\"error\"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\\?(?=&|$)|\\?\\?/;S.ajaxSetup({jsonp:\"callback\",jsonpCallback:function(){var e=zt.pop()||S.expando+\"_\"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter(\"json jsonp\",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?\"url\":\"string\"==typeof e.data&&0===(e.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&Ut.test(e.data)&&\"data\");if(a||\"jsonp\"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,\"$1\"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?\"&\":\"?\")+e.jsonp+\"=\"+r),e.converters[\"script json\"]=function(){return o||S.error(r+\" was not called\"),o[0]},e.dataTypes[0]=\"json\",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),\"script\"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument(\"\").body).innerHTML=\"<form></form><form></form>\",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return\"string\"!=typeof e?[]:(\"boolean\"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument(\"\")).createElement(\"base\")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(\" \");return-1<s&&(r=ht(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&\"object\"==typeof t&&(i=\"POST\"),0<a.length&&S.ajax({url:e,type:i||\"GET\",dataType:\"html\",data:t}).done(function(e){o=arguments,a.html(r?S(\"<div>\").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,\"position\"),c=S(e),f={};\"static\"===l&&(e.style.position=\"relative\"),s=c.offset(),o=S.css(e,\"top\"),u=S.css(e,\"left\"),(\"absolute\"===l||\"fixed\"===l)&&-1<(o+u).indexOf(\"auto\")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),\"using\"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if(\"fixed\"===S.css(r,\"position\"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&\"static\"===S.css(e,\"position\"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,\"borderTopWidth\",!0),i.left+=S.css(e,\"borderLeftWidth\",!0))}return{top:t.top-i.top-S.css(r,\"marginTop\",!0),left:t.left-i.left-S.css(r,\"marginLeft\",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&\"static\"===S.css(e,\"position\"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:\"pageXOffset\",scrollTop:\"pageYOffset\"},function(t,i){var o=\"pageYOffset\"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each([\"top\",\"left\"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+\"px\":t})}),S.each({Height:\"height\",Width:\"width\"},function(a,s){S.each({padding:\"inner\"+a,content:s,\"\":\"outer\"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||\"boolean\"!=typeof e),i=r||(!0===e||!0===t?\"margin\":\"border\");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf(\"outer\")?e[\"inner\"+a]:e.document.documentElement[\"client\"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body[\"scroll\"+a],r[\"scroll\"+a],e.body[\"offset\"+a],r[\"offset\"+a],r[\"client\"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each([\"ajaxStart\",\"ajaxStop\",\"ajaxComplete\",\"ajaxError\",\"ajaxSuccess\",\"ajaxSend\"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,\"**\"):this.off(t,e||\"**\",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each(\"blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu\".split(\" \"),function(e,n){S.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var Xt=/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;S.proxy=function(e,t){var n,r,i;if(\"string\"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||S.guid++,i},S.holdReady=function(e){e?S.readyWait++:S.ready(!0)},S.isArray=Array.isArray,S.parseJSON=JSON.parse,S.nodeName=A,S.isFunction=m,S.isWindow=x,S.camelCase=X,S.type=w,S.now=Date.now,S.isNumeric=function(e){var t=S.type(e);return(\"number\"===t||\"string\"===t)&&!isNaN(e-parseFloat(e))},S.trim=function(e){return null==e?\"\":(e+\"\").replace(Xt,\"\")},\"function\"==typeof define&&define.amd&&define(\"jquery\",[],function(){return S});var Vt=C.jQuery,Gt=C.$;return S.noConflict=function(e){return C.$===S&&(C.$=Gt),e&&C.jQuery===S&&(C.jQuery=Vt),S},\"undefined\"==typeof e&&(C.jQuery=C.$=S),S});\n",
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<script>\n",
       "  // Create a pending promise immediately (this script is not deferred).\n",
       "  window.dataTablePromise = new Promise((resolve) => {\n",
       "    window.__resolveDataTablePromise__ = resolve;\n",
       "  });\n",
       "</script>\n",
       "<script type=\"module\">\n",
       "  // Module scripts are automatically deferred, so this code will not execute immediately.\n",
       "  // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#other_differences_between_modules_and_standard_scripts\n",
       "  if ($.prototype.DataTable === undefined) {\n",
       "      const dt = (await import(\"data:text/javascript;base64,LyohIERhdGFUYWJsZXMgMS4xMi4xCiAqIMKpMjAwOC0yMDIyIFNwcnlNZWRpYSBMdGQgLSBkYXRhdGFibGVzLm5ldC9saWNlbnNlCiAqLwoKLy8gRVNNIGV4cG9ydCBvZiBEYXRhVGFibGVzCmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uICgkLCByb290KSB7CglpZiAoISByb290KSB7CgkJcm9vdCA9IHdpbmRvdzsKCX0KCglpZiAoISAkKSB7CgkJJCA9IHdpbmRvdy5qUXVlcnk7Cgl9CgoJCgl2YXIgRGF0YVRhYmxlID0gZnVuY3Rpb24gKCBzZWxlY3Rvciwgb3B0aW9ucyApCgl7CgkJLy8gV2hlbiBjcmVhdGluZyB3aXRoIGBuZXdgLCBjcmVhdGUgYSBuZXcgRGF0YVRhYmxlLCByZXR1cm5pbmcgdGhlIEFQSSBpbnN0YW5jZQoJCWlmICh0aGlzIGluc3RhbmNlb2YgRGF0YVRhYmxlKSB7CgkJCXJldHVybiAkKHNlbGVjdG9yKS5EYXRhVGFibGUob3B0aW9ucyk7CgkJfQoJCWVsc2UgewoJCQkvL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kgKiAgICAgICAgIHZhbDogICAgICAgZnVuY3Rpb24gKCkge30sICAgICAgIC0tIGZ1bmN0aW9uIC0gQXBpIG1ldGhvZCAob3IgdW5kZWZpbmVkIGlmIGp1c3QgYW4gb2JqZWN0CgkgKiAgICAgICAgIG1ldGhvZEV4dDogWyAuLi4gXSwgICAgICAgICAgICAgIC0tIGFycmF5ICAgIC0gQXJyYXkgb2YgQXBpIG9iamVjdCBkZWZpbml0aW9ucyB0byBleHRlbmQgdGhlIG1ldGhvZCByZXN1bHQKCSAqICAgICAgICAgcHJvcEV4dDogICBbIC4uLiBdICAgICAgICAgICAgICAgLS0gYXJyYXkgICAgLSBBcnJheSBvZiBBcGkgb2JqZWN0IGRlZmluaXRpb25zIHRvIGV4dGVuZCB0aGUgcHJvcGVydHkKCSAqICAgICAgIH0sCgkgKiAgICAgICB7CgkgKiAgICAgICAgIG5hbWU6ICAgICAncm93JwoJICogICAgICAgICB2YWw6ICAgICAgIHt9LAoJICogICAgICAgICBtZXRob2RFeHQ6IFsgLi4uIF0sCgkgKiAgICAgICAgIHByb3BFeHQ6ICAgWwoJICogICAgICAgICAgIHsKCSAqICAgICAgICAgICAgIG5hbWU6ICAgICAgJ2RhdGEnCgkgKiAgICAgICAgICAgICB2YWw6ICAgICAgIGZ1bmN0aW9uICgpIHt9LAoJICogICAgICAgICAgICAgbWV0aG9kRXh0OiBbIC4uLiBdLAoJICogICAgICAgICAgICAgcHJvcEV4dDogICBbIC4uLiBdCgkgKiAgICAgICAgICAgfSwKCSAqICAgICAgICAgICAuLi4KCSAqICAgICAgICAgXQoJICogICAgICAgfQoJICogICAgIF0KCSAqCgkgKiBAdHlwZSB7QXJyYXl9CgkgKiBAaWdub3JlCgkgKi8KCXZhciBfX2FwaVN0cnVjdCA9IFtdOwoJCgkKCS8qKgoJICogYEFycmF5LnByb3RvdHlwZWAgcmVmZXJlbmNlLgoJICoKCSAqIEB0eXBlIG9iamVjdAoJICogQGlnbm9yZQoJICovCgl2YXIgX19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QgT3B0aW9uCgkJICogIEBuYW1lIERhdGFUYWJsZS5kZWZhdWx0cy5kYXRhCgkJICoKCQkgKiAgQGV4YW1wbGUKCQkgKiAgICAvLyBVc2luZyBhIDJEIGFycmF5IGRhdGEgc291cmNlCgkJICogICAgJChkb2N1bWVudCkucmVhZHkoIGZ1bmN0aW9uICgpIHsKCQkgKiAgICAgICQoJyNleGFtcGxlJykuZGF0YVRhYmxlKCB7CgkJICogICAgICAgICJkYXRhIjogWwoJCSAqICAgICAgICAgIFsnVHJpZGVudCcsICdJbnRlcm5ldCBFeHBsb3JlciA0LjAnLCAnV2luIDk1KycsIDQsICdYJ10sCgkJICogICAgICAgICAgWydUcmlkZW50JywgJ0ludGVybmV0IEV4cGxvcmVyIDUuMCcsICdXaW4gOTUrJywgNSwgJ0MnXSwKCQkgKiAgICAgICAgXSwKCQkgKiAgICAgICAgImNvbHVtbnMiOiBbCgkJICogICAgICAgICAgeyAidGl0bGUiOiAiRW5naW5lIiB9LAoJCSAqICAgICAgICAgIHsgInRpdGxlIjogIkJyb3dzZXIiIH0sCgkJICogICAgICAgICAgeyAidGl0bGUiOiAiUGxhdGZvcm0iIH0sCgkJICogICAgICAgICAgeyAidGl0bGUiOiAiVmVyc2lvbiIgfSwKCQkgKiAgICAgICAgICB7ICJ0aXRsZSI6ICJHcmFkZSIgfQoJCSAqICAgICAgICBdCgkJICogICAgICB9ICk7CgkJICogICAgfSApOwoJCSAqCgkJICogIEBleGFtcGxlCgkJICogICAgLy8gVXNpbmcgYW4gYXJyYXkgb2Ygb2JqZWN0cyBhcyBhIGRhdGEgc291cmNlIChgZGF0YWApCgkJICogICAgJChkb2N1bWVudCkucmVhZHkoIGZ1bmN0aW9uICgpIHsKCQkgKiAgICAgICQoJyNleGFtcGxlJykuZGF0YVRhYmxlKCB7CgkJICogICAgICAgICJkYXRhIjogWwoJCSAqICAgICAgICAgIHsKCQkgKiAgICAgICAgICAgICJlbmdpbmUiOiAgICJUcmlkZW50IiwKCQkgKiAgICAgICAgICAgICJicm93c2VyIjogICJJbnRlcm5ldCBFeHBsb3JlciA0LjAiLAoJCSAqICAgICAgICAgICAgInBsYXRmb3JtIjogIldpbiA5NSsiLAoJCSAqICAgICAgICAgICAgInZlcnNpb24iOiAgNCwKCQkgKiAgICAgICAgICAgICJncmFkZSI6ICAgICJYIgoJCSAqICAgICAgICAgIH0sCgkJICogICAgICAgICAgewoJCSAqICAgICAgICAgICAgImVuZ2luZSI6ICAgIlRyaWRlbnQiLAoJCSAqICAgICAgICAgICAgImJyb3dzZXIiOiAgIkludGVybmV0IEV4cGxvcmVyIDUuMCIsCgkJICogICAgICAgICAgICAicGxhdGZvcm0iOiAiV2luIDk1KyIsCgkJICogICAgICAgICAgICAidmVyc2lvbiI6ICA1LAoJCSAqICAgICAgICAgICAgImdyYWRlIjogICAgIkMiCgkJICogICAgICAgICAgfQoJCSAqICAgICAgICBdLAoJCSAqICAgICAgICAiY29sdW1ucyI6IFsKCQkgKiAgICAgICAgICB7ICJ0aXRsZSI6ICJFbmdpbmUiLCAgICJkYXRhIjogImVuZ2luZSIgfSwKCQkgKiAgICAgICAgICB7ICJ0aXRsZSI6ICJCcm93c2VyIiwgICJkYXRhIjogImJyb3dzZXIiIH0sCgkJICogICAgICAgICAgeyAidGl0bGUiOiAiUGxhdGZvcm0iLCAiZGF0YSI6ICJwbGF0Zm9ybSIgfSwKCQkgKiAgICAgICAgICB7ICJ0aXRsZSI6ICJWZXJzaW9uIiwgICJkYXRhIjogInZlcnNpb24iIH0sCgkJICogICAgICAgICAgeyAidGl0bGUiOiAiR3JhZGUiLCAgICAiZGF0YSI6ICJncmFkZSIgfQoJCSAqICAgICAgICBdCgkJICogICAgICB9ICk7CgkJICogICAgfSApOwoJCSAqLwoJCSJhYURhdGEiOiBudWxsLAoJCgkKCQkvKioKCQkgKiBJZiBvcmRlcmluZyBpcyBlbmFibGVkLCB0aGVuIERhdGFUYWJsZXMgd2lsbCBwZXJmb3JtIGEgZmlyc3QgcGFzc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ogWwoJCSAqICAgICAgICAgIHsgIm9yZGVyYWJsZSI6IGZhbHNlIH0sCgkJICogICAgICAgICAgbnVsbCwKCQkgKiAgICAgICAgICBudWxsLAoJCSAqICAgICAgICAgIG51bGwsCgkJICogICAgICAgICAgbnVsbAoJCSAqICAgICAgICBdIH0gKTsKCQkgKiAgICB9ICk7CgkJICovCgkJImJTb3J0YWJsZSI6IHRydWUsCgkKCQoJCS8qKgoJCSAqIEVuYWJsZSBvciBkaXNhYmxlIHRoZSBkaXNwbGF5IG9mIHRoaXMgY29sdW1uLgoJCSAqICBAdHlwZSBib29sZWFuCgkJICogIEBkZWZhdWx0IHRydWUKCQkgKgoJCSAqICBAbmFtZSBEYXRhVGFibGUuZGVmYXVsdHMuY29sdW1uLnZpc2libGUKCQkgKiAgQGR0b3B0IENvbHVtbnMKCQkgKgoJCSAqICBAZXhhbXBsZQoJCSAqICAgIC8vIFVzaW5nIGBjb2x1bW5EZWZzYAoJCSAqICAgICQoZG9jdW1lbnQpLnJlYWR5KCBmdW5jdGlvbigpIHsKCQkgKiAgICAgICQoJyNleGFtcGxlJykuZGF0YVRhYmxlKCB7CgkJICogICAgICAgICJjb2x1bW5EZWZzIjogWwoJCSAqICAgICAgICAgIHsgInZpc2libGUiOiBmYWxzZSwgInRhcmdldHMiOiBbIDAgXSB9CgkJICogICAgICAgIF0gfSApOwoJCSAqICAgIH0gKTsKCQkgKgoJCSAqICBAZXhhbXBsZQoJCSAqICAgIC8vIFVzaW5nIGBjb2x1bW5zYAoJCSAqICAgICQoZG9jdW1lbnQpLnJlYWR5KCBmdW5jdGlvbigpIHsKCQkgKiAgICAgICQoJyNleGFtcGxlJykuZGF0YVRhYmxlKCB7CgkJICogICAgICAgICJjb2x1bW5zIjogWwoJCSAqICAgICAgICAgIHsgInZpc2libGUiOiBmYWxzZSB9LAoJCSAqICAgICAgICAgIG51bGwsCgkJICogICAgICAgICAgbnVsbCwKCQkgKiAgICAgICAgICBudWxsLAoJCSAqICAgICAgICAg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SI6IHt2YWx1ZX0sCgkJICogICAgLy8gICAgICAiYnJvd3NlciI6IHt2YWx1ZX0sCgkJICogICAgLy8gICAgICAicGxhdGZvcm0iOiB7dmFsdWV9LAoJCSAqICAgIC8vICAgICAgInZlcnNpb24iOiB7dmFsdWV9LAoJCSAqICAgIC8vICAgICAgImdyYWRlIjoge3ZhbHVlfQoJCSAqICAgIC8vICAgfQoJCSAqICAgICQoZG9jdW1lbnQpLnJlYWR5KCBmdW5jdGlvbigpIHsKCQkgKiAgICAgICQoJyNleGFtcGxlJykuZGF0YVRhYmxlKCB7CgkJICogICAgICAgICJhamF4U291cmNlIjogInNvdXJjZXMvb2JqZWN0cy50eHQiLAoJCSAqICAgICAgICAiY29sdW1ucyI6IFsKCQkgKiAgICAgICAgICB7ICJkYXRhIjogImVuZ2luZSIgfSwKCQkgKiAgICAgICAgICB7ICJkYXRhIjogImJyb3dzZXIiIH0sCgkJICogICAgICAgICAgeyAiZGF0YSI6ICJwbGF0Zm9ybSIgfSwKCQkgKiAgICAgICAgICB7ICJkYXRhIjogInZlcnNpb24iIH0sCgkJICogICAgICAgICAgeyAiZGF0YSI6ICJncmFkZSIgfQoJCSAqICAgICAgICBdCgkJICogICAgICB9ICk7CgkJICogICAgfSApOwoJCSAqCgkJICogIEBleGFtcGxlCgkJICogICAgLy8gUmVhZCBpbmZvcm1hdGlvbiBmcm9tIGRlZXBseSBuZXN0ZWQgb2JqZWN0cwoJCSAqICAgIC8vIEpTT04gc3RydWN0dXJlIGZvciBlYWNoIHJvdzoKCQkgKiAgICAvLyAgIHsKCQkgKiAgICAvLyAgICAgICJlbmdpbmUiOiB7dmFsdWV9LAoJCSAqICAgIC8vICAgICAgImJyb3dzZXIiOiB7dmFsdWV9LAoJCSAqICAgIC8vICAgICAgInBsYXRmb3JtIjogewoJCSAqICAgIC8vICAgICAgICAgImlubmVyIjoge3ZhbHVlfQoJCSAqICAgIC8vICAgICAgfSwKCQkgKiAgICAvLyAgICAgICJkZXRhaWxzIjogWwoJCSAqICAgIC8vICAgICAgICAge3ZhbHVlfSwge3ZhbHVlfQoJCSAqICAgIC8vICAgICAgXQoJCSAqICAgIC8vICAgfQoJCSAqICAgICQoZG9jdW1lbnQpLnJlYWR5KCBmdW5jdGlvbigpIHsKCQkgKiAgICAgICQoJyNleGFtcGxlJykuZGF0YVRhYmxlKCB7CgkJICogICAgICAgICJhamF4U291cmNlIjogInNvdXJjZXMvZGVlcC50eHQiLAoJCSAqICAgICAgICAiY29sdW1ucyI6IFsKCQkgKiAgICAgICAgICB7ICJkYXRhIjogImVuZ2luZSIgfSwKCQkgKiAgICAgICAgICB7ICJkYXRhIjogImJyb3dzZXIiIH0sCgkJICogICAgICAgICAgeyAiZGF0YSI6ICJwbGF0Zm9ybS5pbm5lciIgfSwKCQkgKiAgICAgICAgICB7ICJkYXRhIjogImRldGFpbHMuMCIgfSwKCQkgKiAgICAgICAgICB7ICJkYXRhIjogImRldGFpbHMuMSIgfQoJCSAqICAgICAgICBdCgkJICogICAgICB9ICk7CgkJICogICAgfSApOwoJCSAqCgkJICogIEBleGFtcGxlCgkJICogICAgLy8gVXNpbmcgYGRhdGFgIGFzIGEgZnVuY3Rpb24gdG8gcHJvdmlkZSBkaWZmZXJlbnQgaW5mb3JtYXRpb24gZm9yCgkJICogICAgLy8gc29ydGluZywgZmlsdGVyaW5nIGFuZCBkaXNwbGF5LiBJbiB0aGlzIGNhc2UsIGN1cnJlbmN5IChwcmljZSkKCQkgKiAgICAkKGRvY3VtZW50KS5yZWFkeSggZnVuY3Rpb24oKSB7CgkJICogICAgICAkKCcjZXhhbXBsZScpLmRhdGFUYWJsZSggewoJCSAqICAgICAgICAiY29sdW1uRGVmcyI6IFsgewoJCSAqICAgICAgICAgICJ0YXJnZXRzIjogWyAwIF0sCgkJICogICAgICAgICAgImRhdGEiOiBmdW5jdGlvbiAoIHNvdXJjZSwgdHlwZSwgdmFsICkgewoJCSAqICAgICAgICAgICAgaWYgKHR5cGUgPT09ICdzZXQnKSB7CgkJICogICAgICAgICAgICAgIHNvdXJjZS5wcmljZSA9IHZhbDsKCQkgKiAgICAgICAgICAgICAgLy8gU3RvcmUgdGhlIGNvbXB1dGVkIGRpc3BsYXkgYW5kIGZpbHRlciB2YWx1ZXMgZm9yIGVmZmljaWVuY3kKCQkgKiAgICAgICAgICAgICAgc291cmNlLnByaWNlX2Rpc3BsYXkgPSB2YWw9PSIiID8gIiIgOiAiJCIrbnVtYmVyRm9ybWF0KHZhbCk7CgkJICogICAgICAgICAgICAgIHNvdXJjZS5wcmljZV9maWx0ZXIgID0gdmFsPT0iIiA/ICIiIDogIiQiK251bWJlckZvcm1hdCh2YWwpKyIgIit2YWw7CgkJICogICAgICAgICAgICAgIHJldHVybjsKCQkgKiAgICAgICAgICAgIH0KCQkgKiAgICAgICAgICAgIGVsc2UgaWYgKHR5cGUgPT09ICdkaXNwbGF5JykgewoJCSAqICAgICAgICAgICAgICByZXR1cm4gc291cmNlLnByaWNlX2Rpc3BsYXk7CgkJICogICAgICAgICAgICB9CgkJICogICAgICAgICAgICBlbHNlIGlmICh0eXBlID09PSAnZmlsdGVyJykgewoJCSAqICAgICAgICAgICAgICByZXR1cm4gc291cmNlLnByaWNlX2ZpbHRlcjsKCQkgKiAgICAgICAgICAgIH0KCQkgKiAgICAgICAgICAgIC8vICdzb3J0JywgJ3R5cGUnIGFuZCB1bmRlZmluZWQgYWxsIGp1c3QgdXNlIHRoZSBpbnRlZ2VyCgkJICogICAgICAgICAgICByZXR1cm4gc291cmNlLnByaWNlOwoJCSAqICAgICAgICAgIH0KCQkgKiAgICAgICAgfSBdCgkJICogICAgICB9ICk7CgkJICogICAgfSApOwoJCSAqCgkJICogIEBleGFtcGxlCgkJICogICAgLy8gVXNpbmcgZGVmYXVsdCBjb250ZW50CgkJICogICAgJChkb2N1bWVudCkucmVhZHkoIGZ1bmN0aW9uKCkgewoJCSAqICAgICAgJCgnI2V4YW1wbGUnKS5kYXRhVGFibGUoIHsKCQkgKiAgICAgICAgIm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Y3Rpb24sIHdoaWxlIGBwaG9uZV9maWx0ZXJgCgkJICogICAgLy8gKHdoaWNoIGhhcyBib3RoIGZvcm1zKSBpcyB1c2VkIGZvciBmaWx0ZXJpbmcgZm9yIGlmIGEgdXNlciBpbnB1dHMgZWl0aGVyIGZvcm1hdCwgd2hpbGUKCQkgKiAgICAvLyB0aGUgZm9ybWF0dGVkIHBob25lIG51bWJlciBpcyB0aGUgb25lIHRoYXQgaXMgc2hvd24gaW4gdGhlIHRhYmxlLgoJCSAqICAgICQoZG9jdW1lbnQpLnJlYWR5KCBmdW5jdGlvbigpIHsKCQkgKiAgICAgICQoJyNleGFtcGxlJykuZGF0YVRhYmxlKCB7CgkJICogICAgICAgICJjb2x1bW5EZWZzIjogWyB7CgkJICogICAgICAgICAgInRhcmdldHMiOiBbIDAgXSwKCQkgKiAgICAgICAgICAiZGF0YSI6IG51bGwsIC8vIFVzZSB0aGUgZnVsbCBkYXRhIHNvdXJjZSBvYmplY3QgZm9yIHRoZSByZW5kZXJlcidzIHNvdXJjZQoJCSAqICAgICAgICAgICJyZW5kZXIiOiB7CgkJICogICAgICAgICAgICAiXyI6ICJwaG9uZSIsCgkJICogICAgICAgICAgICAiZmlsdGVyIjogInBob25lX2ZpbHRlciIsCgkJICogICAgICAgICAgICAiZGlzcGxheSI6ICJwaG9uZV9kaXNwbGF5IgoJCSAqICAgICAgICAgIH0KCQkgKiAgICAgICAgfSBdCgkJICogICAgICB9ICk7CgkJICogICAgfSApOwoJCSAqCgkJICogIEBleGFtcGxlCgkJICogICAgLy8gVXNlIGFzIGEgZnVuY3Rpb24gdG8gY3JlYXRlIGEgbGluayBmcm9tIHRoZSBkYXRhIHNvdXJjZQoJCSAqICAgICQoZG9jdW1lbnQpLnJlYWR5KCBmdW5jdGlvbigpIHsKCQkgKiAgICAgICQoJyNleGFtcGxlJykuZGF0YVRhYmxlKCB7CgkJICogICAgICAgICJjb2x1bW5EZWZzIjogWyB7CgkJICogICAgICAgICAgInRhcmdldHM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ICAgICQoJyNleGFtcGxlJykuZGF0YVRhYmxlKCB7CgkJICogICAgICAgICJjb2x1bW5EZWZzIjogWwoJCSAqICAgICAgICAgIHsKCQkgKiAgICAgICAgICAgICJkYXRhIjogbnVsbCwKCQkgKiAgICAgICAgICAgICJkZWZhdWx0Q29udGVudCI6ICJFZGl0IiwKCQkgKiAgICAgICAgICAgICJ0YXJnZXRzIjogWyAtMSBdCgkJICogICAgICAgICAgfQoJCSAqICAgICAgICBdCgkJICogICAgICB9ICk7CgkJICogICAgfSApOwoJCSAqCgkJICogIEBleGFtcGxlCgkJICogICAgLy8gVXNpbmcgYGNvbHVtbnNgCgkJICogICAgJChkb2N1bWVudCkucmVhZHkoIGZ1bmN0aW9uKCkgewoJCSAqICAgICAgJCgnI2V4YW1wbGUnKS5kYXRhVGFibGUoIHsKCQkgKiAgICAgICAgImNvbHVtbnMiOiBbCgkJICogICAgICAgICAgbnVsbCwKCQkgKiAgICAgICAgICBudWxsLAoJCSAqICAgICAgICAgIG51bGwsCgkJICogICAgICAgICAgewoJCSAqICAgICAgICAgICAgImRhdGEiOiBudWxsLAoJCSAqICAgICAgICAgICAgImRlZmF1bHRDb250ZW50IjogIkVkaXQiCgkJICogICAgICAgICAgfQoJCSAqICAgICAgICBdCgkJICogICAgICB9ICk7CgkJICogICAgfSApOwoJCSAqLwoJCSJzRGVmYXVsdENvbnRlbnQiOiBudWxsLAoJCgkKCQkvKioKCQkgKiBUaGlzIHBhcmFtZXRlciBpcyBvbmx5IHVzZWQgaW4gRGF0YVRhYmxlcycgc2VydmVyLXNpZGUgcHJvY2Vzc2luZy4gSXQgY2FuCgkJICogYmUgZXhjZXB0aW9uYWxseSB1c2VmdWwgdG8ga25vdyB3aGF0IGNvbHVtbnMgYXJlIGJlaW5nIGRpc3BsYXllZCBvbiB0aGUKCQkgKiBjbGllbnQgc2lkZSwgYW5kIHRvIG1hcCB0aGVzZSB0byBkYXRhYmFzZSBmaWVsZHMuIFdoZW4gZGVmaW5lZCwg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x1bW5EZWZzYAoJCSAqICAgICQoZG9jdW1lbnQpLnJlYWR5KCBmdW5jdGlvbigpIHsKCQkgKiAgICAgICQoJyNleGFtcGxlJykuZGF0YVRhYmxlKCB7CgkJICogICAgICAgICJjb2x1bW5EZWZzIjogWwoJCSAqICAgICAgICAgIHsgIm9yZGVyRGF0YVR5cGUiOiAiZG9tLXRleHQiLCAidGFyZ2V0cyI6IFsgMiwgMyBdIH0sCgkJICogICAgICAgICAgeyAidHlwZSI6ICJudW1lcmljIiwgInRhcmdldHMiOiBbIDMgXSB9LAoJCSAqICAgICAgICAgIHsgIm9yZGVyRGF0YVR5cGUiOiAiZG9tLXNlbGVjdCIsICJ0YXJnZXRzIjogWyA0IF0gfSwKCQkgKiAgICAgICAgICB7ICJvcmRlckRhdGFUeXBlIjogImRvbS1jaGVja2JveCIsICJ0YXJnZXRzIjogWyA1IF0gfQoJCSAqICAgICAgICBdCgkJICogICAgICB9ICk7CgkJICogICAgfSApOwoJCSAqCgkJICogIEBleGFtcGxlCgkJICogICAgLy8gVXNpbmcgYGNvbHVtbnNgCgkJICogICAgJChkb2N1bWVudCkucmVhZHkoIGZ1bmN0aW9uKCkgewoJCSAqICAgICAgJCgnI2V4YW1wbGUnKS5kYXRhVGFibGUoIHsKCQkgKiAgICAgICAgImNvbHVtbnMiOiBbCgkJICogICAgICAgICAgbnVsbCwKCQkgKiAgICAgICAgICBudWxsLAoJCSAqICAgICAgICAgIHsgIm9yZGVyRGF0YVR5cGUiOiAiZG9tLXRleHQiIH0sCgkJICogICAgICAgICAgeyAib3JkZXJEYXRhVHlwZSI6ICJkb20tdGV4dCIsICJ0eXBlIjogIm51bWVyaWMiIH0sCgkJICogICAgICAgICAgeyAib3JkZXJEYXRhVHlwZSI6ICJkb20tc2VsZWN0IiB9LAoJCSAqICAgICAgICAgIHsgIm9yZGVyRGF0YVR5cGUiOiAiZG9tLWNoZWNrYm94IiB9CgkJICogICAgICAgIF0KCQkgKiAgICAgIH0gKTsKCQkgK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gYSBEYXRhVGFibGVzIEFQSSBpbnN0YW5jZSByYXRoZXIgdGhhbiBhCgkvLyBqUXVlcnkgb2JqZWN0CgkkLmZuLkRhdGFUYWJsZSA9IGZ1bmN0aW9uICggb3B0cyApIHsKCQlyZXR1cm4gJCh0aGlzKS5kYXRhVGFibGUoIG9wdHMgKS5hcGkoKTsKCX07CgkKCS8vIEFsbCBwcm9wZXJ0aWVzIHRoYXQgYXJlIGF2YWlsYWJsZSB0byAkLmZuLmRhdGFUYWJsZSBzaG91bGQgYWxzbyBiZQoJLy8gYXZhaWxhYmxlIG9uICQuZm4uRGF0YVRhYmxlCgkkLmVhY2goIERhdGFUYWJsZSwgZnVuY3Rpb24gKCBwcm9wLCB2YWwgKSB7CgkJJC5mbi5EYXRhVGFibGVbIHByb3AgXSA9IHZhbDsKCX0gKTsKCQoJcmV0dXJuIERhdGFUYWJsZTsKfQo=\")).default;\n",
       "      dt(window.$);\n",
       "      // Resolve the pending promise above, indicating that DataTable is now ready to be used.\n",
       "      window.__resolveDataTablePromise__();\n",
       "  }\n",
       "</script>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<style>table.dataTable td.dt-control{text-align:center;cursor:pointer}table.dataTable td.dt-control:before{height:1em;width:1em;margin-top:-9px;display:inline-block;color:white;border:.15em solid white;border-radius:1em;box-shadow:0 0 .2em #444;box-sizing:content-box;text-align:center;text-indent:0 !important;font-family:\"Courier New\",Courier,monospace;line-height:1em;content:\"+\";background-color:#31b131}table.dataTable tr.dt-hasChild td.dt-control:before{content:\"-\";background-color:#d33333}table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting_asc_disabled,table.dataTable thead>tr>th.sorting_desc_disabled,table.dataTable thead>tr>td.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting_asc_disabled,table.dataTable thead>tr>td.sorting_desc_disabled{cursor:pointer;position:relative;padding-right:26px}table.dataTable thead>tr>th.sorting:before,table.dataTable thead>tr>th.sorting:after,table.dataTable thead>tr>th.sorting_asc:before,table.dataTable thead>tr>th.sorting_asc:after,table.dataTable thead>tr>th.sorting_desc:before,table.dataTable thead>tr>th.sorting_desc:after,table.dataTable thead>tr>th.sorting_asc_disabled:before,table.dataTable thead>tr>th.sorting_asc_disabled:after,table.dataTable thead>tr>th.sorting_desc_disabled:before,table.dataTable thead>tr>th.sorting_desc_disabled:after,table.dataTable thead>tr>td.sorting:before,table.dataTable thead>tr>td.sorting:after,table.dataTable thead>tr>td.sorting_asc:before,table.dataTable thead>tr>td.sorting_asc:after,table.dataTable thead>tr>td.sorting_desc:before,table.dataTable thead>tr>td.sorting_desc:after,table.dataTable thead>tr>td.sorting_asc_disabled:before,table.dataTable thead>tr>td.sorting_asc_disabled:after,table.dataTable thead>tr>td.sorting_desc_disabled:before,table.dataTable thead>tr>td.sorting_desc_disabled:after{position:absolute;display:block;opacity:.125;right:10px;line-height:9px;font-size:.8em}table.dataTable thead>tr>th.sorting:before,table.dataTable thead>tr>th.sorting_asc:before,table.dataTable thead>tr>th.sorting_desc:before,table.dataTable thead>tr>th.sorting_asc_disabled:before,table.dataTable thead>tr>th.sorting_desc_disabled:before,table.dataTable thead>tr>td.sorting:before,table.dataTable thead>tr>td.sorting_asc:before,table.dataTable thead>tr>td.sorting_desc:before,table.dataTable thead>tr>td.sorting_asc_disabled:before,table.dataTable thead>tr>td.sorting_desc_disabled:before{bottom:50%;content:\"▲\"}table.dataTable thead>tr>th.sorting:after,table.dataTable thead>tr>th.sorting_asc:after,table.dataTable thead>tr>th.sorting_desc:after,table.dataTable thead>tr>th.sorting_asc_disabled:after,table.dataTable thead>tr>th.sorting_desc_disabled:after,table.dataTable thead>tr>td.sorting:after,table.dataTable thead>tr>td.sorting_asc:after,table.dataTable thead>tr>td.sorting_desc:after,table.dataTable thead>tr>td.sorting_asc_disabled:after,table.dataTable thead>tr>td.sorting_desc_disabled:after{top:50%;content:\"▼\"}table.dataTable thead>tr>th.sorting_asc:before,table.dataTable thead>tr>th.sorting_desc:after,table.dataTable thead>tr>td.sorting_asc:before,table.dataTable thead>tr>td.sorting_desc:after{opacity:.6}table.dataTable thead>tr>th.sorting_desc_disabled:after,table.dataTable thead>tr>th.sorting_asc_disabled:before,table.dataTable thead>tr>td.sorting_desc_disabled:after,table.dataTable thead>tr>td.sorting_asc_disabled:before{display:none}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}div.dataTables_scrollBody table.dataTable thead>tr>th:before,div.dataTables_scrollBody table.dataTable thead>tr>th:after,div.dataTables_scrollBody table.dataTable thead>tr>td:before,div.dataTables_scrollBody table.dataTable thead>tr>td:after{display:none}div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:2px}div.dataTables_processing>div:last-child{position:relative;width:80px;height:15px;margin:1em auto}div.dataTables_processing>div:last-child>div{position:absolute;top:0;width:13px;height:13px;border-radius:50%;background:rgba(13, 110, 253, 0.9);animation-timing-function:cubic-bezier(0, 1, 1, 0)}div.dataTables_processing>div:last-child>div:nth-child(1){left:8px;animation:datatables-loader-1 .6s infinite}div.dataTables_processing>div:last-child>div:nth-child(2){left:8px;animation:datatables-loader-2 .6s infinite}div.dataTables_processing>div:last-child>div:nth-child(3){left:32px;animation:datatables-loader-2 .6s infinite}div.dataTables_processing>div:last-child>div:nth-child(4){left:56px;animation:datatables-loader-3 .6s infinite}@keyframes datatables-loader-1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes datatables-loader-3{0%{transform:scale(1)}100%{transform:scale(0)}}@keyframes datatables-loader-2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}table.dataTable th.dt-left,table.dataTable td.dt-left{text-align:left}table.dataTable th.dt-center,table.dataTable td.dt-center,table.dataTable td.dataTables_empty{text-align:center}table.dataTable th.dt-right,table.dataTable td.dt-right{text-align:right}table.dataTable th.dt-justify,table.dataTable td.dt-justify{text-align:justify}table.dataTable th.dt-nowrap,table.dataTable td.dt-nowrap{white-space:nowrap}table.dataTable thead th,table.dataTable thead td,table.dataTable tfoot th,table.dataTable tfoot td{text-align:left}table.dataTable thead th.dt-head-left,table.dataTable thead td.dt-head-left,table.dataTable tfoot th.dt-head-left,table.dataTable tfoot td.dt-head-left{text-align:left}table.dataTable thead th.dt-head-center,table.dataTable thead td.dt-head-center,table.dataTable tfoot th.dt-head-center,table.dataTable tfoot td.dt-head-center{text-align:center}table.dataTable thead th.dt-head-right,table.dataTable thead td.dt-head-right,table.dataTable tfoot th.dt-head-right,table.dataTable tfoot td.dt-head-right{text-align:right}table.dataTable thead th.dt-head-justify,table.dataTable thead td.dt-head-justify,table.dataTable tfoot th.dt-head-justify,table.dataTable tfoot td.dt-head-justify{text-align:justify}table.dataTable thead th.dt-head-nowrap,table.dataTable thead td.dt-head-nowrap,table.dataTable tfoot th.dt-head-nowrap,table.dataTable tfoot td.dt-head-nowrap{white-space:nowrap}table.dataTable tbody th.dt-body-left,table.dataTable tbody td.dt-body-left{text-align:left}table.dataTable tbody th.dt-body-center,table.dataTable tbody td.dt-body-center{text-align:center}table.dataTable tbody th.dt-body-right,table.dataTable tbody td.dt-body-right{text-align:right}table.dataTable tbody th.dt-body-justify,table.dataTable tbody td.dt-body-justify{text-align:justify}table.dataTable tbody th.dt-body-nowrap,table.dataTable tbody td.dt-body-nowrap{white-space:nowrap}table.dataTable{width:100%;margin:0 auto;clear:both;border-collapse:separate;border-spacing:0}table.dataTable thead th,table.dataTable tfoot th{font-weight:bold}table.dataTable thead th,table.dataTable thead td{padding:10px;border-bottom:1px solid rgba(0, 0, 0, 0.3)}table.dataTable thead th:active,table.dataTable thead td:active{outline:none}table.dataTable tfoot th,table.dataTable tfoot td{padding:10px 10px 6px 10px;border-top:1px solid rgba(0, 0, 0, 0.3)}table.dataTable tbody tr{background-color:transparent}table.dataTable tbody tr.selected>*{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.9);color:white}table.dataTable tbody tr.selected a{color:#090a0b}table.dataTable tbody th,table.dataTable tbody td{padding:8px 10px}table.dataTable.row-border tbody th,table.dataTable.row-border tbody td,table.dataTable.display tbody th,table.dataTable.display tbody td{border-top:1px solid rgba(0, 0, 0, 0.15)}table.dataTable.row-border tbody tr:first-child th,table.dataTable.row-border tbody tr:first-child td,table.dataTable.display tbody tr:first-child th,table.dataTable.display tbody tr:first-child td{border-top:none}table.dataTable.cell-border tbody th,table.dataTable.cell-border tbody td{border-top:1px solid rgba(0, 0, 0, 0.15);border-right:1px solid rgba(0, 0, 0, 0.15)}table.dataTable.cell-border tbody tr th:first-child,table.dataTable.cell-border tbody tr td:first-child{border-left:1px solid rgba(0, 0, 0, 0.15)}table.dataTable.cell-border tbody tr:first-child th,table.dataTable.cell-border tbody tr:first-child td{border-top:none}table.dataTable.stripe>tbody>tr.odd>*,table.dataTable.display>tbody>tr.odd>*{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.023)}table.dataTable.stripe>tbody>tr.odd.selected>*,table.dataTable.display>tbody>tr.odd.selected>*{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.923)}table.dataTable.hover>tbody>tr:hover>*,table.dataTable.display>tbody>tr:hover>*{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.035)}table.dataTable.hover>tbody>tr.selected:hover>*,table.dataTable.display>tbody>tr.selected:hover>*{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.935)}table.dataTable.order-column>tbody tr>.sorting_1,table.dataTable.order-column>tbody tr>.sorting_2,table.dataTable.order-column>tbody tr>.sorting_3,table.dataTable.display>tbody tr>.sorting_1,table.dataTable.display>tbody tr>.sorting_2,table.dataTable.display>tbody tr>.sorting_3{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.019)}table.dataTable.order-column>tbody tr.selected>.sorting_1,table.dataTable.order-column>tbody tr.selected>.sorting_2,table.dataTable.order-column>tbody tr.selected>.sorting_3,table.dataTable.display>tbody tr.selected>.sorting_1,table.dataTable.display>tbody tr.selected>.sorting_2,table.dataTable.display>tbody tr.selected>.sorting_3{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.919)}table.dataTable.display>tbody>tr.odd>.sorting_1,table.dataTable.order-column.stripe>tbody>tr.odd>.sorting_1{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.054)}table.dataTable.display>tbody>tr.odd>.sorting_2,table.dataTable.order-column.stripe>tbody>tr.odd>.sorting_2{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.047)}table.dataTable.display>tbody>tr.odd>.sorting_3,table.dataTable.order-column.stripe>tbody>tr.odd>.sorting_3{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.039)}table.dataTable.display>tbody>tr.odd.selected>.sorting_1,table.dataTable.order-column.stripe>tbody>tr.odd.selected>.sorting_1{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.954)}table.dataTable.display>tbody>tr.odd.selected>.sorting_2,table.dataTable.order-column.stripe>tbody>tr.odd.selected>.sorting_2{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.947)}table.dataTable.display>tbody>tr.odd.selected>.sorting_3,table.dataTable.order-column.stripe>tbody>tr.odd.selected>.sorting_3{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.939)}table.dataTable.display>tbody>tr.even>.sorting_1,table.dataTable.order-column.stripe>tbody>tr.even>.sorting_1{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.019)}table.dataTable.display>tbody>tr.even>.sorting_2,table.dataTable.order-column.stripe>tbody>tr.even>.sorting_2{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.011)}table.dataTable.display>tbody>tr.even>.sorting_3,table.dataTable.order-column.stripe>tbody>tr.even>.sorting_3{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.003)}table.dataTable.display>tbody>tr.even.selected>.sorting_1,table.dataTable.order-column.stripe>tbody>tr.even.selected>.sorting_1{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.919)}table.dataTable.display>tbody>tr.even.selected>.sorting_2,table.dataTable.order-column.stripe>tbody>tr.even.selected>.sorting_2{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.911)}table.dataTable.display>tbody>tr.even.selected>.sorting_3,table.dataTable.order-column.stripe>tbody>tr.even.selected>.sorting_3{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.903)}table.dataTable.display tbody tr:hover>.sorting_1,table.dataTable.order-column.hover tbody tr:hover>.sorting_1{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.082)}table.dataTable.display tbody tr:hover>.sorting_2,table.dataTable.order-column.hover tbody tr:hover>.sorting_2{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.074)}table.dataTable.display tbody tr:hover>.sorting_3,table.dataTable.order-column.hover tbody tr:hover>.sorting_3{box-shadow:inset 0 0 0 9999px rgba(0, 0, 0, 0.062)}table.dataTable.display tbody tr:hover.selected>.sorting_1,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_1{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.982)}table.dataTable.display tbody tr:hover.selected>.sorting_2,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_2{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.974)}table.dataTable.display tbody tr:hover.selected>.sorting_3,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_3{box-shadow:inset 0 0 0 9999px rgba(13, 110, 253, 0.962)}table.dataTable.no-footer{border-bottom:1px solid rgba(0, 0, 0, 0.3)}table.dataTable.compact thead th,table.dataTable.compact thead td,table.dataTable.compact tfoot th,table.dataTable.compact tfoot td,table.dataTable.compact tbody th,table.dataTable.compact tbody td{padding:4px}table.dataTable th,table.dataTable td{box-sizing:content-box}.dataTables_wrapper{position:relative;clear:both}.dataTables_wrapper .dataTables_length{float:left}.dataTables_wrapper .dataTables_length select{border:1px solid #aaa;border-radius:3px;padding:5px;background-color:transparent;padding:4px}.dataTables_wrapper .dataTables_filter{float:right;text-align:right}.dataTables_wrapper .dataTables_filter input{border:1px solid #aaa;border-radius:3px;padding:5px;background-color:transparent;margin-left:3px}.dataTables_wrapper .dataTables_info{clear:both;float:left;padding-top:.755em}.dataTables_wrapper .dataTables_paginate{float:right;text-align:right;padding-top:.25em}.dataTables_wrapper .dataTables_paginate .paginate_button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:.5em 1em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;color:inherit !important;border:1px solid transparent;border-radius:2px}.dataTables_wrapper .dataTables_paginate .paginate_button.current,.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover{color:inherit !important;border:1px solid rgba(0, 0, 0, 0.3);background-color:rgba(230, 230, 230, 0.1);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(230, 230, 230, 0.1)), color-stop(100%, rgba(0, 0, 0, 0.1)));background:-webkit-linear-gradient(top, rgba(230, 230, 230, 0.1) 0%, rgba(0, 0, 0, 0.1) 100%);background:-moz-linear-gradient(top, rgba(230, 230, 230, 0.1) 0%, rgba(0, 0, 0, 0.1) 100%);background:-ms-linear-gradient(top, rgba(230, 230, 230, 0.1) 0%, rgba(0, 0, 0, 0.1) 100%);background:-o-linear-gradient(top, rgba(230, 230, 230, 0.1) 0%, rgba(0, 0, 0, 0.1) 100%);background:linear-gradient(to bottom, rgba(230, 230, 230, 0.1) 0%, rgba(0, 0, 0, 0.1) 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active{cursor:default;color:#666 !important;border:1px solid transparent;background:transparent;box-shadow:none}.dataTables_wrapper .dataTables_paginate .paginate_button:hover{color:white !important;border:1px solid #111;background-color:#585858;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));background:-webkit-linear-gradient(top, #585858 0%, #111 100%);background:-moz-linear-gradient(top, #585858 0%, #111 100%);background:-ms-linear-gradient(top, #585858 0%, #111 100%);background:-o-linear-gradient(top, #585858 0%, #111 100%);background:linear-gradient(to bottom, #585858 0%, #111 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button:active{outline:none;background-color:#2b2b2b;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));background:-webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);box-shadow:inset 0 0 3px #111}.dataTables_wrapper .dataTables_paginate .ellipsis{padding:0 1em}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:inherit}.dataTables_wrapper .dataTables_scroll{clear:both}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody{-webkit-overflow-scrolling:touch}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td{vertical-align:middle}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>thead>tr>td>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody>table>tbody>tr>td>div.dataTables_sizing{height:0;overflow:hidden;margin:0 !important;padding:0 !important}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:1px solid rgba(0, 0, 0, 0.3)}.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable,.dataTables_wrapper.no-footer div.dataTables_scrollBody>table{border-bottom:none}.dataTables_wrapper:after{visibility:hidden;display:block;content:\"\";clear:both;height:0}@media screen and (max-width: 767px){.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_paginate{float:none;text-align:center}.dataTables_wrapper .dataTables_paginate{margin-top:.5em}}@media screen and (max-width: 640px){.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter{float:none;text-align:center}.dataTables_wrapper .dataTables_filter{margin-top:.5em}}\n",
       "</style>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "init_notebook_mode(connected=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false,
    "jupyter": {
     "outputs_hidden": false
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>.itables table td {\n",
       "    text-overflow: ellipsis;\n",
       "    overflow: hidden;\n",
       "}\n",
       "\n",
       ".itables table th {\n",
       "    text-overflow: ellipsis;\n",
       "    overflow: hidden;\n",
       "}\n",
       "\n",
       ".itables thead input {\n",
       "    width: 100%;\n",
       "    padding: 3px;\n",
       "    box-sizing: border-box;\n",
       "}\n",
       "\n",
       ".itables tfoot input {\n",
       "    width: 100%;\n",
       "    padding: 3px;\n",
       "    box-sizing: border-box;\n",
       "}\n",
       "</style>\n",
       "<div class=\"itables\">\n",
       "<table id=\"b0e06eed-986f-42d8-b9de-6a3bda967805\" class=\"display nowrap\"style=\"table-layout:auto;width:auto;margin:auto;caption-side:bottom\"><thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>region</th>\n",
       "      <th>country</th>\n",
       "      <th>capital</th>\n",
       "      <th>longitude</th>\n",
       "      <th>latitude</th>\n",
       "      <th>flag</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>code</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead><tbody><tr><td>Loading... (need <a href=https://mwouts.github.io/itables/troubleshooting.html>help</a>?)</td></tr></tbody></table>\n",
       "<script>\n",
       "    // We use a namespace per table (= the next curly bracket)\n",
       "    // to avoid conflicts between the various tables' data & dt_args\n",
       "    {\n",
       "        // Define the table data\n",
       "        const data = [[\"AW\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Aruba\\\">Aruba</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Oranjestad\\\">Oranjestad</a>\", -70.0167, 12.5167, \"<a href=\\\"https://flagpedia.net/aw\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/aw.webp\\\" alt=\\\"Flag of Aruba\\\"></a>\"], [\"AF\", \"South Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Afghanistan\\\">Afghanistan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kabul\\\">Kabul</a>\", 69.1761, 34.5228, \"<a href=\\\"https://flagpedia.net/af\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/af.webp\\\" alt=\\\"Flag of Afghanistan\\\"></a>\"], [\"AO\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Angola\\\">Angola</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Luanda\\\">Luanda</a>\", 13.242, -8.81155, \"<a href=\\\"https://flagpedia.net/ao\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ao.webp\\\" alt=\\\"Flag of Angola\\\"></a>\"], [\"AL\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Albania\\\">Albania</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tirane\\\">Tirane</a>\", 19.8172, 41.3317, \"<a href=\\\"https://flagpedia.net/al\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/al.webp\\\" alt=\\\"Flag of Albania\\\"></a>\"], [\"AD\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Andorra\\\">Andorra</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Andorra la Vella\\\">Andorra la Vella</a>\", 1.5218, 42.5075, \"<a href=\\\"https://flagpedia.net/ad\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ad.webp\\\" alt=\\\"Flag of Andorra\\\"></a>\"], [\"AE\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/United Arab Emirates\\\">United Arab Emirates</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Abu Dhabi\\\">Abu Dhabi</a>\", 54.3705, 24.4764, \"<a href=\\\"https://flagpedia.net/ae\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ae.webp\\\" alt=\\\"Flag of United Arab Emirates\\\"></a>\"], [\"AR\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Argentina\\\">Argentina</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Buenos Aires\\\">Buenos Aires</a>\", -58.4173, -34.6118, \"<a href=\\\"https://flagpedia.net/ar\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ar.webp\\\" alt=\\\"Flag of Argentina\\\"></a>\"], [\"AM\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Armenia\\\">Armenia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Yerevan\\\">Yerevan</a>\", 44.509, 40.1596, \"<a href=\\\"https://flagpedia.net/am\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/am.webp\\\" alt=\\\"Flag of Armenia\\\"></a>\"], [\"AS\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/American Samoa\\\">American Samoa</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Pago Pago\\\">Pago Pago</a>\", -170.691, -14.2846, \"<a href=\\\"https://flagpedia.net/as\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/as.webp\\\" alt=\\\"Flag of American Samoa\\\"></a>\"], [\"AG\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Antigua and Barbuda\\\">Antigua and Barbuda</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Saint John's\\\">Saint John's</a>\", -61.8456, 17.1175, \"<a href=\\\"https://flagpedia.net/ag\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ag.webp\\\" alt=\\\"Flag of Antigua and Barbuda\\\"></a>\"], [\"AU\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Australia\\\">Australia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Canberra\\\">Canberra</a>\", 149.129, -35.282, \"<a href=\\\"https://flagpedia.net/au\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/au.webp\\\" alt=\\\"Flag of Australia\\\"></a>\"], [\"AT\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Austria\\\">Austria</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Vienna\\\">Vienna</a>\", 16.3798, 48.2201, \"<a href=\\\"https://flagpedia.net/at\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/at.webp\\\" alt=\\\"Flag of Austria\\\"></a>\"], [\"AZ\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Azerbaijan\\\">Azerbaijan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Baku\\\">Baku</a>\", 49.8932, 40.3834, \"<a href=\\\"https://flagpedia.net/az\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/az.webp\\\" alt=\\\"Flag of Azerbaijan\\\"></a>\"], [\"BI\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Burundi\\\">Burundi</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bujumbura\\\">Bujumbura</a>\", 29.3639, -3.3784, \"<a href=\\\"https://flagpedia.net/bi\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bi.webp\\\" alt=\\\"Flag of Burundi\\\"></a>\"], [\"BE\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Belgium\\\">Belgium</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Brussels\\\">Brussels</a>\", 4.36761, 50.8371, \"<a href=\\\"https://flagpedia.net/be\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/be.webp\\\" alt=\\\"Flag of Belgium\\\"></a>\"], [\"BJ\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Benin\\\">Benin</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Porto-Novo\\\">Porto-Novo</a>\", 2.6323, 6.4779, \"<a href=\\\"https://flagpedia.net/bj\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bj.webp\\\" alt=\\\"Flag of Benin\\\"></a>\"], [\"BF\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Burkina Faso\\\">Burkina Faso</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Ouagadougou\\\">Ouagadougou</a>\", -1.53395, 12.3605, \"<a href=\\\"https://flagpedia.net/bf\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bf.webp\\\" alt=\\\"Flag of Burkina Faso\\\"></a>\"], [\"BD\", \"South Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bangladesh\\\">Bangladesh</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Dhaka\\\">Dhaka</a>\", 90.4113, 23.7055, \"<a href=\\\"https://flagpedia.net/bd\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bd.webp\\\" alt=\\\"Flag of Bangladesh\\\"></a>\"], [\"BG\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bulgaria\\\">Bulgaria</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Sofia\\\">Sofia</a>\", 23.3238, 42.7105, \"<a href=\\\"https://flagpedia.net/bg\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bg.webp\\\" alt=\\\"Flag of Bulgaria\\\"></a>\"], [\"BH\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bahrain\\\">Bahrain</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Manama\\\">Manama</a>\", 50.5354, 26.1921, \"<a href=\\\"https://flagpedia.net/bh\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bh.webp\\\" alt=\\\"Flag of Bahrain\\\"></a>\"], [\"BS\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Bahamas, The\\\">Bahamas, The</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Nassau\\\">Nassau</a>\", -77.339, 25.0661, \"<a href=\\\"https://flagpedia.net/bs\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bs.webp\\\" alt=\\\"Flag of Bahamas, The\\\"></a>\"], [\"BA\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bosnia and Herzegovina\\\">Bosnia and Herzegovina</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Sarajevo\\\">Sarajevo</a>\", 18.4214, 43.8607, \"<a href=\\\"https://flagpedia.net/ba\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ba.webp\\\" alt=\\\"Flag of Bosnia and Herzegovina\\\"></a>\"], [\"BY\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Belarus\\\">Belarus</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Minsk\\\">Minsk</a>\", 27.5766, 53.9678, \"<a href=\\\"https://flagpedia.net/by\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/by.webp\\\" alt=\\\"Flag of Belarus\\\"></a>\"], [\"BZ\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Belize\\\">Belize</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Belmopan\\\">Belmopan</a>\", -88.7713, 17.2534, \"<a href=\\\"https://flagpedia.net/bz\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bz.webp\\\" alt=\\\"Flag of Belize\\\"></a>\"], [\"BM\", \"North America\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bermuda\\\">Bermuda</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Hamilton\\\">Hamilton</a>\", -64.706, 32.3293, \"<a href=\\\"https://flagpedia.net/bm\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bm.webp\\\" alt=\\\"Flag of Bermuda\\\"></a>\"], [\"BO\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Bolivia\\\">Bolivia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/La Paz\\\">La Paz</a>\", -66.1936, -13.9908, \"<a href=\\\"https://flagpedia.net/bo\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bo.webp\\\" alt=\\\"Flag of Bolivia\\\"></a>\"], [\"BR\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Brazil\\\">Brazil</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Brasilia\\\">Brasilia</a>\", -47.9292, -15.7801, \"<a href=\\\"https://flagpedia.net/br\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/br.webp\\\" alt=\\\"Flag of Brazil\\\"></a>\"], [\"BB\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Barbados\\\">Barbados</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bridgetown\\\">Bridgetown</a>\", -59.6105, 13.0935, \"<a href=\\\"https://flagpedia.net/bb\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bb.webp\\\" alt=\\\"Flag of Barbados\\\"></a>\"], [\"BN\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Brunei Darussalam\\\">Brunei Darussalam</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bandar Seri Begawan\\\">Bandar Seri Begawan</a>\", 114.946, 4.94199, \"<a href=\\\"https://flagpedia.net/bn\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bn.webp\\\" alt=\\\"Flag of Brunei Darussalam\\\"></a>\"], [\"BT\", \"South Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bhutan\\\">Bhutan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Thimphu\\\">Thimphu</a>\", 89.6177, 27.5768, \"<a href=\\\"https://flagpedia.net/bt\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bt.webp\\\" alt=\\\"Flag of Bhutan\\\"></a>\"], [\"BW\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Botswana\\\">Botswana</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Gaborone\\\">Gaborone</a>\", 25.9201, -24.6544, \"<a href=\\\"https://flagpedia.net/bw\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/bw.webp\\\" alt=\\\"Flag of Botswana\\\"></a>\"], [\"CF\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Central African Republic\\\">Central African Republic</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bangui\\\">Bangui</a>\", 21.6407, 5.63056, \"<a href=\\\"https://flagpedia.net/cf\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cf.webp\\\" alt=\\\"Flag of Central African Republic\\\"></a>\"], [\"CA\", \"North America\", \"<a href=\\\"https://en.wikipedia.org/wiki/Canada\\\">Canada</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Ottawa\\\">Ottawa</a>\", -75.6919, 45.4215, \"<a href=\\\"https://flagpedia.net/ca\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ca.webp\\\" alt=\\\"Flag of Canada\\\"></a>\"], [\"CH\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Switzerland\\\">Switzerland</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bern\\\">Bern</a>\", 7.44821, 46.948, \"<a href=\\\"https://flagpedia.net/ch\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ch.webp\\\" alt=\\\"Flag of Switzerland\\\"></a>\"], [\"CL\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Chile\\\">Chile</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Santiago\\\">Santiago</a>\", -70.6475, -33.475, \"<a href=\\\"https://flagpedia.net/cl\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cl.webp\\\" alt=\\\"Flag of Chile\\\"></a>\"], [\"CN\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/China\\\">China</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Beijing\\\">Beijing</a>\", 116.286, 40.0495, \"<a href=\\\"https://flagpedia.net/cn\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cn.webp\\\" alt=\\\"Flag of China\\\"></a>\"], [\"CI\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Cote d'Ivoire\\\">Cote d'Ivoire</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Yamoussoukro\\\">Yamoussoukro</a>\", -4.0305, 5.332, \"<a href=\\\"https://flagpedia.net/ci\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ci.webp\\\" alt=\\\"Flag of Cote d'Ivoire\\\"></a>\"], [\"CM\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Cameroon\\\">Cameroon</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Yaounde\\\">Yaounde</a>\", 11.5174, 3.8721, \"<a href=\\\"https://flagpedia.net/cm\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cm.webp\\\" alt=\\\"Flag of Cameroon\\\"></a>\"], [\"CD\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Congo, Dem. Rep.\\\">Congo, Dem. Rep.</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kinshasa\\\">Kinshasa</a>\", 15.3222, -4.325, \"<a href=\\\"https://flagpedia.net/cd\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cd.webp\\\" alt=\\\"Flag of Congo, Dem. Rep.\\\"></a>\"], [\"CG\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Congo, Rep.\\\">Congo, Rep.</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Brazzaville\\\">Brazzaville</a>\", 15.2662, -4.2767, \"<a href=\\\"https://flagpedia.net/cg\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cg.webp\\\" alt=\\\"Flag of Congo, Rep.\\\"></a>\"], [\"CO\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Colombia\\\">Colombia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bogota\\\">Bogota</a>\", -74.082, 4.60987, \"<a href=\\\"https://flagpedia.net/co\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/co.webp\\\" alt=\\\"Flag of Colombia\\\"></a>\"], [\"KM\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Comoros\\\">Comoros</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Moroni\\\">Moroni</a>\", 43.2418, -11.6986, \"<a href=\\\"https://flagpedia.net/km\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/km.webp\\\" alt=\\\"Flag of Comoros\\\"></a>\"], [\"CV\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Cabo Verde\\\">Cabo Verde</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Praia\\\">Praia</a>\", -23.5087, 14.9218, \"<a href=\\\"https://flagpedia.net/cv\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cv.webp\\\" alt=\\\"Flag of Cabo Verde\\\"></a>\"], [\"CR\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Costa Rica\\\">Costa Rica</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/San Jose\\\">San Jose</a>\", -84.0089, 9.63701, \"<a href=\\\"https://flagpedia.net/cr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cr.webp\\\" alt=\\\"Flag of Costa Rica\\\"></a>\"], [\"CU\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Cuba\\\">Cuba</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Havana\\\">Havana</a>\", -82.3667, 23.1333, \"<a href=\\\"https://flagpedia.net/cu\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cu.webp\\\" alt=\\\"Flag of Cuba\\\"></a>\"], [\"KY\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Cayman Islands\\\">Cayman Islands</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/George Town\\\">George Town</a>\", -81.3857, 19.3022, \"<a href=\\\"https://flagpedia.net/ky\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ky.webp\\\" alt=\\\"Flag of Cayman Islands\\\"></a>\"], [\"CY\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Cyprus\\\">Cyprus</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Nicosia\\\">Nicosia</a>\", 33.3736, 35.1676, \"<a href=\\\"https://flagpedia.net/cy\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cy.webp\\\" alt=\\\"Flag of Cyprus\\\"></a>\"], [\"CZ\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Czech Republic\\\">Czech Republic</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Prague\\\">Prague</a>\", 14.4205, 50.0878, \"<a href=\\\"https://flagpedia.net/cz\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/cz.webp\\\" alt=\\\"Flag of Czech Republic\\\"></a>\"], [\"DE\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Germany\\\">Germany</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Berlin\\\">Berlin</a>\", 13.4115, 52.5235, \"<a href=\\\"https://flagpedia.net/de\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/de.webp\\\" alt=\\\"Flag of Germany\\\"></a>\"], [\"DJ\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Djibouti\\\">Djibouti</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Djibouti\\\">Djibouti</a>\", 43.1425, 11.5806, \"<a href=\\\"https://flagpedia.net/dj\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/dj.webp\\\" alt=\\\"Flag of Djibouti\\\"></a>\"], [\"DM\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Dominica\\\">Dominica</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Roseau\\\">Roseau</a>\", -61.39, 15.2976, \"<a href=\\\"https://flagpedia.net/dm\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/dm.webp\\\" alt=\\\"Flag of Dominica\\\"></a>\"], [\"DK\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Denmark\\\">Denmark</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Copenhagen\\\">Copenhagen</a>\", 12.5681, 55.6763, \"<a href=\\\"https://flagpedia.net/dk\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/dk.webp\\\" alt=\\\"Flag of Denmark\\\"></a>\"], [\"DO\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Dominican Republic\\\">Dominican Republic</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Santo Domingo\\\">Santo Domingo</a>\", -69.8908, 18.479, \"<a href=\\\"https://flagpedia.net/do\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/do.webp\\\" alt=\\\"Flag of Dominican Republic\\\"></a>\"], [\"DZ\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Algeria\\\">Algeria</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Algiers\\\">Algiers</a>\", 3.05097, 36.7397, \"<a href=\\\"https://flagpedia.net/dz\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/dz.webp\\\" alt=\\\"Flag of Algeria\\\"></a>\"], [\"EC\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Ecuador\\\">Ecuador</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Quito\\\">Quito</a>\", -78.5243, -0.229498, \"<a href=\\\"https://flagpedia.net/ec\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ec.webp\\\" alt=\\\"Flag of Ecuador\\\"></a>\"], [\"EG\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Egypt, Arab Rep.\\\">Egypt, Arab Rep.</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Cairo\\\">Cairo</a>\", 31.2461, 30.0982, \"<a href=\\\"https://flagpedia.net/eg\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/eg.webp\\\" alt=\\\"Flag of Egypt, Arab Rep.\\\"></a>\"], [\"ER\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Eritrea\\\">Eritrea</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Asmara\\\">Asmara</a>\", 38.9183, 15.3315, \"<a href=\\\"https://flagpedia.net/er\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/er.webp\\\" alt=\\\"Flag of Eritrea\\\"></a>\"], [\"ES\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Spain\\\">Spain</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Madrid\\\">Madrid</a>\", -3.70327, 40.4167, \"<a href=\\\"https://flagpedia.net/es\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/es.webp\\\" alt=\\\"Flag of Spain\\\"></a>\"], [\"EE\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Estonia\\\">Estonia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tallinn\\\">Tallinn</a>\", 24.7586, 59.4392, \"<a href=\\\"https://flagpedia.net/ee\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ee.webp\\\" alt=\\\"Flag of Estonia\\\"></a>\"], [\"ET\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Ethiopia\\\">Ethiopia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Addis Ababa\\\">Addis Ababa</a>\", 38.7468, 9.02274, \"<a href=\\\"https://flagpedia.net/et\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/et.webp\\\" alt=\\\"Flag of Ethiopia\\\"></a>\"], [\"FI\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Finland\\\">Finland</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Helsinki\\\">Helsinki</a>\", 24.9525, 60.1608, \"<a href=\\\"https://flagpedia.net/fi\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/fi.webp\\\" alt=\\\"Flag of Finland\\\"></a>\"], [\"FJ\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Fiji\\\">Fiji</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Suva\\\">Suva</a>\", 178.399, -18.1149, \"<a href=\\\"https://flagpedia.net/fj\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/fj.webp\\\" alt=\\\"Flag of Fiji\\\"></a>\"], [\"FR\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/France\\\">France</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Paris\\\">Paris</a>\", 2.35097, 48.8566, \"<a href=\\\"https://flagpedia.net/fr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/fr.webp\\\" alt=\\\"Flag of France\\\"></a>\"], [\"FO\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Faroe Islands\\\">Faroe Islands</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Torshavn\\\">Torshavn</a>\", -6.91181, 61.8926, \"<a href=\\\"https://flagpedia.net/fo\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/fo.webp\\\" alt=\\\"Flag of Faroe Islands\\\"></a>\"], [\"FM\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Micronesia, Fed. Sts.\\\">Micronesia, Fed. Sts.</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Palikir\\\">Palikir</a>\", 158.185, 6.91771, \"<a href=\\\"https://flagpedia.net/fm\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/fm.webp\\\" alt=\\\"Flag of Micronesia, Fed. Sts.\\\"></a>\"], [\"GA\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Gabon\\\">Gabon</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Libreville\\\">Libreville</a>\", 9.45162, 0.38832, \"<a href=\\\"https://flagpedia.net/ga\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ga.webp\\\" alt=\\\"Flag of Gabon\\\"></a>\"], [\"GB\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/United Kingdom\\\">United Kingdom</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/London\\\">London</a>\", -0.126236, 51.5002, \"<a href=\\\"https://flagpedia.net/gb\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gb.webp\\\" alt=\\\"Flag of United Kingdom\\\"></a>\"], [\"GE\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Georgia\\\">Georgia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tbilisi\\\">Tbilisi</a>\", 44.793, 41.71, \"<a href=\\\"https://flagpedia.net/ge\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ge.webp\\\" alt=\\\"Flag of Georgia\\\"></a>\"], [\"GH\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Ghana\\\">Ghana</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Accra\\\">Accra</a>\", -0.20795, 5.57045, \"<a href=\\\"https://flagpedia.net/gh\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gh.webp\\\" alt=\\\"Flag of Ghana\\\"></a>\"], [\"GN\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Guinea\\\">Guinea</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Conakry\\\">Conakry</a>\", -13.7, 9.51667, \"<a href=\\\"https://flagpedia.net/gn\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gn.webp\\\" alt=\\\"Flag of Guinea\\\"></a>\"], [\"GM\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Gambia, The\\\">Gambia, The</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Banjul\\\">Banjul</a>\", -16.5885, 13.4495, \"<a href=\\\"https://flagpedia.net/gm\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gm.webp\\\" alt=\\\"Flag of Gambia, The\\\"></a>\"], [\"GW\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Guinea-Bissau\\\">Guinea-Bissau</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bissau\\\">Bissau</a>\", -15.1804, 11.8037, \"<a href=\\\"https://flagpedia.net/gw\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gw.webp\\\" alt=\\\"Flag of Guinea-Bissau\\\"></a>\"], [\"GQ\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Equatorial Guinea\\\">Equatorial Guinea</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Malabo\\\">Malabo</a>\", 8.7741, 3.7523, \"<a href=\\\"https://flagpedia.net/gq\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gq.webp\\\" alt=\\\"Flag of Equatorial Guinea\\\"></a>\"], [\"GR\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Greece\\\">Greece</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Athens\\\">Athens</a>\", 23.7166, 37.9792, \"<a href=\\\"https://flagpedia.net/gr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gr.webp\\\" alt=\\\"Flag of Greece\\\"></a>\"], [\"GD\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Grenada\\\">Grenada</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Saint George's\\\">Saint George's</a>\", -61.7449, 12.0653, \"<a href=\\\"https://flagpedia.net/gd\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gd.webp\\\" alt=\\\"Flag of Grenada\\\"></a>\"], [\"GL\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Greenland\\\">Greenland</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Nuuk\\\">Nuuk</a>\", -51.7214, 64.1836, \"<a href=\\\"https://flagpedia.net/gl\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gl.webp\\\" alt=\\\"Flag of Greenland\\\"></a>\"], [\"GT\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Guatemala\\\">Guatemala</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Guatemala City\\\">Guatemala City</a>\", -90.5328, 14.6248, \"<a href=\\\"https://flagpedia.net/gt\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gt.webp\\\" alt=\\\"Flag of Guatemala\\\"></a>\"], [\"GU\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Guam\\\">Guam</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Agana\\\">Agana</a>\", 144.794, 13.4443, \"<a href=\\\"https://flagpedia.net/gu\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gu.webp\\\" alt=\\\"Flag of Guam\\\"></a>\"], [\"GY\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Guyana\\\">Guyana</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Georgetown\\\">Georgetown</a>\", -58.1548, 6.80461, \"<a href=\\\"https://flagpedia.net/gy\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/gy.webp\\\" alt=\\\"Flag of Guyana\\\"></a>\"], [\"HN\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Honduras\\\">Honduras</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tegucigalpa\\\">Tegucigalpa</a>\", -87.4667, 15.1333, \"<a href=\\\"https://flagpedia.net/hn\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/hn.webp\\\" alt=\\\"Flag of Honduras\\\"></a>\"], [\"HR\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Croatia\\\">Croatia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Zagreb\\\">Zagreb</a>\", 15.9614, 45.8069, \"<a href=\\\"https://flagpedia.net/hr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/hr.webp\\\" alt=\\\"Flag of Croatia\\\"></a>\"], [\"HT\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Haiti\\\">Haiti</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Port-au-Prince\\\">Port-au-Prince</a>\", -72.3288, 18.5392, \"<a href=\\\"https://flagpedia.net/ht\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ht.webp\\\" alt=\\\"Flag of Haiti\\\"></a>\"], [\"HU\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Hungary\\\">Hungary</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Budapest\\\">Budapest</a>\", 19.0408, 47.4984, \"<a href=\\\"https://flagpedia.net/hu\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/hu.webp\\\" alt=\\\"Flag of Hungary\\\"></a>\"], [\"ID\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Indonesia\\\">Indonesia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Jakarta\\\">Jakarta</a>\", 106.83, -6.19752, \"<a href=\\\"https://flagpedia.net/id\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/id.webp\\\" alt=\\\"Flag of Indonesia\\\"></a>\"], [\"IM\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Isle of Man\\\">Isle of Man</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Douglas\\\">Douglas</a>\", -4.47928, 54.1509, \"<a href=\\\"https://flagpedia.net/im\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/im.webp\\\" alt=\\\"Flag of Isle of Man\\\"></a>\"], [\"IN\", \"South Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/India\\\">India</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/New Delhi\\\">New Delhi</a>\", 77.225, 28.6353, \"<a href=\\\"https://flagpedia.net/in\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/in.webp\\\" alt=\\\"Flag of India\\\"></a>\"], [\"IE\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Ireland\\\">Ireland</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Dublin\\\">Dublin</a>\", -6.26749, 53.3441, \"<a href=\\\"https://flagpedia.net/ie\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ie.webp\\\" alt=\\\"Flag of Ireland\\\"></a>\"], [\"IR\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Iran, Islamic Rep.\\\">Iran, Islamic Rep.</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tehran\\\">Tehran</a>\", 51.4447, 35.6878, \"<a href=\\\"https://flagpedia.net/ir\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ir.webp\\\" alt=\\\"Flag of Iran, Islamic Rep.\\\"></a>\"], [\"IQ\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Iraq\\\">Iraq</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Baghdad\\\">Baghdad</a>\", 44.394, 33.3302, \"<a href=\\\"https://flagpedia.net/iq\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/iq.webp\\\" alt=\\\"Flag of Iraq\\\"></a>\"], [\"IS\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Iceland\\\">Iceland</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Reykjavik\\\">Reykjavik</a>\", -21.8952, 64.1353, \"<a href=\\\"https://flagpedia.net/is\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/is.webp\\\" alt=\\\"Flag of Iceland\\\"></a>\"], [\"IT\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Italy\\\">Italy</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Rome\\\">Rome</a>\", 12.4823, 41.8955, \"<a href=\\\"https://flagpedia.net/it\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/it.webp\\\" alt=\\\"Flag of Italy\\\"></a>\"], [\"JM\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Jamaica\\\">Jamaica</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kingston\\\">Kingston</a>\", -76.792, 17.9927, \"<a href=\\\"https://flagpedia.net/jm\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/jm.webp\\\" alt=\\\"Flag of Jamaica\\\"></a>\"], [\"JO\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Jordan\\\">Jordan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Amman\\\">Amman</a>\", 35.9263, 31.9497, \"<a href=\\\"https://flagpedia.net/jo\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/jo.webp\\\" alt=\\\"Flag of Jordan\\\"></a>\"], [\"JP\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Japan\\\">Japan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tokyo\\\">Tokyo</a>\", 139.77, 35.67, \"<a href=\\\"https://flagpedia.net/jp\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/jp.webp\\\" alt=\\\"Flag of Japan\\\"></a>\"], [\"KZ\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kazakhstan\\\">Kazakhstan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Astana\\\">Astana</a>\", 71.4382, 51.1879, \"<a href=\\\"https://flagpedia.net/kz\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/kz.webp\\\" alt=\\\"Flag of Kazakhstan\\\"></a>\"], [\"KE\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Kenya\\\">Kenya</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Nairobi\\\">Nairobi</a>\", 36.8126, -1.27975, \"<a href=\\\"https://flagpedia.net/ke\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ke.webp\\\" alt=\\\"Flag of Kenya\\\"></a>\"], [\"KG\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kyrgyz Republic\\\">Kyrgyz Republic</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bishkek\\\">Bishkek</a>\", 74.6057, 42.8851, \"<a href=\\\"https://flagpedia.net/kg\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/kg.webp\\\" alt=\\\"Flag of Kyrgyz Republic\\\"></a>\"], [\"KH\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Cambodia\\\">Cambodia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Phnom Penh\\\">Phnom Penh</a>\", 104.874, 11.5556, \"<a href=\\\"https://flagpedia.net/kh\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/kh.webp\\\" alt=\\\"Flag of Cambodia\\\"></a>\"], [\"KI\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kiribati\\\">Kiribati</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tarawa\\\">Tarawa</a>\", 172.979, 1.32905, \"<a href=\\\"https://flagpedia.net/ki\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ki.webp\\\" alt=\\\"Flag of Kiribati\\\"></a>\"], [\"KN\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/St. Kitts and Nevis\\\">St. Kitts and Nevis</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Basseterre\\\">Basseterre</a>\", -62.7309, 17.3, \"<a href=\\\"https://flagpedia.net/kn\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/kn.webp\\\" alt=\\\"Flag of St. Kitts and Nevis\\\"></a>\"], [\"KR\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Korea, Rep.\\\">Korea, Rep.</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Seoul\\\">Seoul</a>\", 126.957, 37.5323, \"<a href=\\\"https://flagpedia.net/kr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/kr.webp\\\" alt=\\\"Flag of Korea, Rep.\\\"></a>\"], [\"KW\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kuwait\\\">Kuwait</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kuwait City\\\">Kuwait City</a>\", 47.9824, 29.3721, \"<a href=\\\"https://flagpedia.net/kw\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/kw.webp\\\" alt=\\\"Flag of Kuwait\\\"></a>\"], [\"LA\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Lao PDR\\\">Lao PDR</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Vientiane\\\">Vientiane</a>\", 102.177, 18.5826, \"<a href=\\\"https://flagpedia.net/la\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/la.webp\\\" alt=\\\"Flag of Lao PDR\\\"></a>\"], [\"LB\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Lebanon\\\">Lebanon</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Beirut\\\">Beirut</a>\", 35.5134, 33.8872, \"<a href=\\\"https://flagpedia.net/lb\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/lb.webp\\\" alt=\\\"Flag of Lebanon\\\"></a>\"], [\"LR\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Liberia\\\">Liberia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Monrovia\\\">Monrovia</a>\", -10.7957, 6.30039, \"<a href=\\\"https://flagpedia.net/lr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/lr.webp\\\" alt=\\\"Flag of Liberia\\\"></a>\"], [\"LY\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Libya\\\">Libya</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tripoli\\\">Tripoli</a>\", 13.1072, 32.8578, \"<a href=\\\"https://flagpedia.net/ly\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ly.webp\\\" alt=\\\"Flag of Libya\\\"></a>\"], [\"LC\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/St. Lucia\\\">St. Lucia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Castries\\\">Castries</a>\", -60.9832, 14.0, \"<a href=\\\"https://flagpedia.net/lc\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/lc.webp\\\" alt=\\\"Flag of St. Lucia\\\"></a>\"], [\"LI\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Liechtenstein\\\">Liechtenstein</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Vaduz\\\">Vaduz</a>\", 9.52148, 47.1411, \"<a href=\\\"https://flagpedia.net/li\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/li.webp\\\" alt=\\\"Flag of Liechtenstein\\\"></a>\"], [\"LK\", \"South Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Sri Lanka\\\">Sri Lanka</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Colombo\\\">Colombo</a>\", 79.8528, 6.92148, \"<a href=\\\"https://flagpedia.net/lk\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/lk.webp\\\" alt=\\\"Flag of Sri Lanka\\\"></a>\"], [\"LS\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Lesotho\\\">Lesotho</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Maseru\\\">Maseru</a>\", 27.7167, -29.5208, \"<a href=\\\"https://flagpedia.net/ls\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ls.webp\\\" alt=\\\"Flag of Lesotho\\\"></a>\"], [\"LT\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Lithuania\\\">Lithuania</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Vilnius\\\">Vilnius</a>\", 25.2799, 54.6896, \"<a href=\\\"https://flagpedia.net/lt\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/lt.webp\\\" alt=\\\"Flag of Lithuania\\\"></a>\"], [\"LU\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Luxembourg\\\">Luxembourg</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Luxembourg\\\">Luxembourg</a>\", 6.1296, 49.61, \"<a href=\\\"https://flagpedia.net/lu\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/lu.webp\\\" alt=\\\"Flag of Luxembourg\\\"></a>\"], [\"LV\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Latvia\\\">Latvia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Riga\\\">Riga</a>\", 24.1048, 56.9465, \"<a href=\\\"https://flagpedia.net/lv\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/lv.webp\\\" alt=\\\"Flag of Latvia\\\"></a>\"], [\"MA\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Morocco\\\">Morocco</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Rabat\\\">Rabat</a>\", -6.8704, 33.9905, \"<a href=\\\"https://flagpedia.net/ma\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ma.webp\\\" alt=\\\"Flag of Morocco\\\"></a>\"], [\"MC\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Monaco\\\">Monaco</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Monaco\\\">Monaco</a>\", 7.41891, 43.7325, \"<a href=\\\"https://flagpedia.net/mc\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mc.webp\\\" alt=\\\"Flag of Monaco\\\"></a>\"], [\"MD\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Moldova\\\">Moldova</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Chisinau\\\">Chisinau</a>\", 28.8497, 47.0167, \"<a href=\\\"https://flagpedia.net/md\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/md.webp\\\" alt=\\\"Flag of Moldova\\\"></a>\"], [\"MG\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Madagascar\\\">Madagascar</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Antananarivo\\\">Antananarivo</a>\", 45.7167, -20.4667, \"<a href=\\\"https://flagpedia.net/mg\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mg.webp\\\" alt=\\\"Flag of Madagascar\\\"></a>\"], [\"MV\", \"South Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Maldives\\\">Maldives</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Male\\\">Male</a>\", 73.5109, 4.1742, \"<a href=\\\"https://flagpedia.net/mv\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mv.webp\\\" alt=\\\"Flag of Maldives\\\"></a>\"], [\"MX\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Mexico\\\">Mexico</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Mexico City\\\">Mexico City</a>\", -99.1276, 19.427, \"<a href=\\\"https://flagpedia.net/mx\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mx.webp\\\" alt=\\\"Flag of Mexico\\\"></a>\"], [\"MH\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Marshall Islands\\\">Marshall Islands</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Majuro\\\">Majuro</a>\", 171.135, 7.11046, \"<a href=\\\"https://flagpedia.net/mh\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mh.webp\\\" alt=\\\"Flag of Marshall Islands\\\"></a>\"], [\"MK\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/North Macedonia\\\">North Macedonia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Skopje\\\">Skopje</a>\", 21.4361, 42.0024, \"<a href=\\\"https://flagpedia.net/mk\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mk.webp\\\" alt=\\\"Flag of North Macedonia\\\"></a>\"], [\"ML\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Mali\\\">Mali</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bamako\\\">Bamako</a>\", -7.50034, 13.5667, \"<a href=\\\"https://flagpedia.net/ml\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ml.webp\\\" alt=\\\"Flag of Mali\\\"></a>\"], [\"MT\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Malta\\\">Malta</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Valletta\\\">Valletta</a>\", 14.5189, 35.9042, \"<a href=\\\"https://flagpedia.net/mt\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mt.webp\\\" alt=\\\"Flag of Malta\\\"></a>\"], [\"MM\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Myanmar\\\">Myanmar</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Naypyidaw\\\">Naypyidaw</a>\", 95.9562, 21.914, \"<a href=\\\"https://flagpedia.net/mm\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mm.webp\\\" alt=\\\"Flag of Myanmar\\\"></a>\"], [\"ME\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Montenegro\\\">Montenegro</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Podgorica\\\">Podgorica</a>\", 19.2595, 42.4602, \"<a href=\\\"https://flagpedia.net/me\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/me.webp\\\" alt=\\\"Flag of Montenegro\\\"></a>\"], [\"MN\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Mongolia\\\">Mongolia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Ulaanbaatar\\\">Ulaanbaatar</a>\", 106.937, 47.9129, \"<a href=\\\"https://flagpedia.net/mn\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mn.webp\\\" alt=\\\"Flag of Mongolia\\\"></a>\"], [\"MP\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Northern Mariana Islands\\\">Northern Mariana Islands</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Saipan\\\">Saipan</a>\", 145.765, 15.1935, \"<a href=\\\"https://flagpedia.net/mp\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mp.webp\\\" alt=\\\"Flag of Northern Mariana Islands\\\"></a>\"], [\"MZ\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Mozambique\\\">Mozambique</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Maputo\\\">Maputo</a>\", 32.5713, -25.9664, \"<a href=\\\"https://flagpedia.net/mz\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mz.webp\\\" alt=\\\"Flag of Mozambique\\\"></a>\"], [\"MR\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Mauritania\\\">Mauritania</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Nouakchott\\\">Nouakchott</a>\", -15.9824, 18.2367, \"<a href=\\\"https://flagpedia.net/mr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mr.webp\\\" alt=\\\"Flag of Mauritania\\\"></a>\"], [\"MU\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Mauritius\\\">Mauritius</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Port Louis\\\">Port Louis</a>\", 57.4977, -20.1605, \"<a href=\\\"https://flagpedia.net/mu\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mu.webp\\\" alt=\\\"Flag of Mauritius\\\"></a>\"], [\"MW\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Malawi\\\">Malawi</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Lilongwe\\\">Lilongwe</a>\", 33.7703, -13.9899, \"<a href=\\\"https://flagpedia.net/mw\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/mw.webp\\\" alt=\\\"Flag of Malawi\\\"></a>\"], [\"MY\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Malaysia\\\">Malaysia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kuala Lumpur\\\">Kuala Lumpur</a>\", 101.684, 3.12433, \"<a href=\\\"https://flagpedia.net/my\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/my.webp\\\" alt=\\\"Flag of Malaysia\\\"></a>\"], [\"NA\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Namibia\\\">Namibia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Windhoek\\\">Windhoek</a>\", 17.0931, -22.5648, \"<a href=\\\"https://flagpedia.net/na\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/na.webp\\\" alt=\\\"Flag of Namibia\\\"></a>\"], [\"NC\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/New Caledonia\\\">New Caledonia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Noum'ea\\\">Noum'ea</a>\", 166.464, -22.2677, \"<a href=\\\"https://flagpedia.net/nc\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/nc.webp\\\" alt=\\\"Flag of New Caledonia\\\"></a>\"], [\"NE\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Niger\\\">Niger</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Niamey\\\">Niamey</a>\", 2.1073, 13.514, \"<a href=\\\"https://flagpedia.net/ne\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ne.webp\\\" alt=\\\"Flag of Niger\\\"></a>\"], [\"NG\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Nigeria\\\">Nigeria</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Abuja\\\">Abuja</a>\", 7.48906, 9.05804, \"<a href=\\\"https://flagpedia.net/ng\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ng.webp\\\" alt=\\\"Flag of Nigeria\\\"></a>\"], [\"NI\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Nicaragua\\\">Nicaragua</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Managua\\\">Managua</a>\", -86.2734, 12.1475, \"<a href=\\\"https://flagpedia.net/ni\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ni.webp\\\" alt=\\\"Flag of Nicaragua\\\"></a>\"], [\"NL\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Netherlands\\\">Netherlands</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Amsterdam\\\">Amsterdam</a>\", 4.89095, 52.3738, \"<a href=\\\"https://flagpedia.net/nl\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/nl.webp\\\" alt=\\\"Flag of Netherlands\\\"></a>\"], [\"NO\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Norway\\\">Norway</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Oslo\\\">Oslo</a>\", 10.7387, 59.9138, \"<a href=\\\"https://flagpedia.net/no\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/no.webp\\\" alt=\\\"Flag of Norway\\\"></a>\"], [\"NP\", \"South Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Nepal\\\">Nepal</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kathmandu\\\">Kathmandu</a>\", 85.3157, 27.6939, \"<a href=\\\"https://flagpedia.net/np\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/np.webp\\\" alt=\\\"Flag of Nepal\\\"></a>\"], [\"NR\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Nauru\\\">Nauru</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Yaren District\\\">Yaren District</a>\", 166.920867, -0.5477, \"<a href=\\\"https://flagpedia.net/nr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/nr.webp\\\" alt=\\\"Flag of Nauru\\\"></a>\"], [\"NZ\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/New Zealand\\\">New Zealand</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Wellington\\\">Wellington</a>\", 174.776, -41.2865, \"<a href=\\\"https://flagpedia.net/nz\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/nz.webp\\\" alt=\\\"Flag of New Zealand\\\"></a>\"], [\"OM\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Oman\\\">Oman</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Muscat\\\">Muscat</a>\", 58.5874, 23.6105, \"<a href=\\\"https://flagpedia.net/om\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/om.webp\\\" alt=\\\"Flag of Oman\\\"></a>\"], [\"PK\", \"South Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Pakistan\\\">Pakistan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Islamabad\\\">Islamabad</a>\", 72.8, 30.5167, \"<a href=\\\"https://flagpedia.net/pk\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/pk.webp\\\" alt=\\\"Flag of Pakistan\\\"></a>\"], [\"PA\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Panama\\\">Panama</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Panama City\\\">Panama City</a>\", -79.5188, 8.99427, \"<a href=\\\"https://flagpedia.net/pa\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/pa.webp\\\" alt=\\\"Flag of Panama\\\"></a>\"], [\"PE\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Peru\\\">Peru</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Lima\\\">Lima</a>\", -77.0465, -12.0931, \"<a href=\\\"https://flagpedia.net/pe\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/pe.webp\\\" alt=\\\"Flag of Peru\\\"></a>\"], [\"PH\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Philippines\\\">Philippines</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Manila\\\">Manila</a>\", 121.035, 14.5515, \"<a href=\\\"https://flagpedia.net/ph\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ph.webp\\\" alt=\\\"Flag of Philippines\\\"></a>\"], [\"PW\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Palau\\\">Palau</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Koror\\\">Koror</a>\", 134.479, 7.34194, \"<a href=\\\"https://flagpedia.net/pw\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/pw.webp\\\" alt=\\\"Flag of Palau\\\"></a>\"], [\"PG\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Papua New Guinea\\\">Papua New Guinea</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Port Moresby\\\">Port Moresby</a>\", 147.194, -9.47357, \"<a href=\\\"https://flagpedia.net/pg\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/pg.webp\\\" alt=\\\"Flag of Papua New Guinea\\\"></a>\"], [\"PL\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Poland\\\">Poland</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Warsaw\\\">Warsaw</a>\", 21.02, 52.26, \"<a href=\\\"https://flagpedia.net/pl\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/pl.webp\\\" alt=\\\"Flag of Poland\\\"></a>\"], [\"PR\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Puerto Rico\\\">Puerto Rico</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/San Juan\\\">San Juan</a>\", -66.0, 18.23, \"<a href=\\\"https://flagpedia.net/pr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/pr.webp\\\" alt=\\\"Flag of Puerto Rico\\\"></a>\"], [\"KP\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Korea, Dem. People's Rep.\\\">Korea, Dem. People's Rep.</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Pyongyang\\\">Pyongyang</a>\", 125.754, 39.0319, \"<a href=\\\"https://flagpedia.net/kp\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/kp.webp\\\" alt=\\\"Flag of Korea, Dem. People's Rep.\\\"></a>\"], [\"PT\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Portugal\\\">Portugal</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Lisbon\\\">Lisbon</a>\", -9.13552, 38.7072, \"<a href=\\\"https://flagpedia.net/pt\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/pt.webp\\\" alt=\\\"Flag of Portugal\\\"></a>\"], [\"PY\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Paraguay\\\">Paraguay</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Asuncion\\\">Asuncion</a>\", -57.6362, -25.3005, \"<a href=\\\"https://flagpedia.net/py\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/py.webp\\\" alt=\\\"Flag of Paraguay\\\"></a>\"], [\"PF\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/French Polynesia\\\">French Polynesia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Papeete\\\">Papeete</a>\", -149.57, -17.535, \"<a href=\\\"https://flagpedia.net/pf\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/pf.webp\\\" alt=\\\"Flag of French Polynesia\\\"></a>\"], [\"QA\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Qatar\\\">Qatar</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Doha\\\">Doha</a>\", 51.5082, 25.2948, \"<a href=\\\"https://flagpedia.net/qa\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/qa.webp\\\" alt=\\\"Flag of Qatar\\\"></a>\"], [\"RO\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Romania\\\">Romania</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bucharest\\\">Bucharest</a>\", 26.0979, 44.4479, \"<a href=\\\"https://flagpedia.net/ro\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ro.webp\\\" alt=\\\"Flag of Romania\\\"></a>\"], [\"RU\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Russian Federation\\\">Russian Federation</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Moscow\\\">Moscow</a>\", 37.6176, 55.7558, \"<a href=\\\"https://flagpedia.net/ru\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ru.webp\\\" alt=\\\"Flag of Russian Federation\\\"></a>\"], [\"RW\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Rwanda\\\">Rwanda</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kigali\\\">Kigali</a>\", 30.0587, -1.95325, \"<a href=\\\"https://flagpedia.net/rw\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/rw.webp\\\" alt=\\\"Flag of Rwanda\\\"></a>\"], [\"SA\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Saudi Arabia\\\">Saudi Arabia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Riyadh\\\">Riyadh</a>\", 46.6977, 24.6748, \"<a href=\\\"https://flagpedia.net/sa\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sa.webp\\\" alt=\\\"Flag of Saudi Arabia\\\"></a>\"], [\"SD\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Sudan\\\">Sudan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Khartoum\\\">Khartoum</a>\", 32.5363, 15.5932, \"<a href=\\\"https://flagpedia.net/sd\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sd.webp\\\" alt=\\\"Flag of Sudan\\\"></a>\"], [\"SN\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Senegal\\\">Senegal</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Dakar\\\">Dakar</a>\", -17.4734, 14.7247, \"<a href=\\\"https://flagpedia.net/sn\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sn.webp\\\" alt=\\\"Flag of Senegal\\\"></a>\"], [\"SG\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Singapore\\\">Singapore</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Singapore\\\">Singapore</a>\", 103.85, 1.28941, \"<a href=\\\"https://flagpedia.net/sg\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sg.webp\\\" alt=\\\"Flag of Singapore\\\"></a>\"], [\"SB\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Solomon Islands\\\">Solomon Islands</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Honiara\\\">Honiara</a>\", 159.949, -9.42676, \"<a href=\\\"https://flagpedia.net/sb\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sb.webp\\\" alt=\\\"Flag of Solomon Islands\\\"></a>\"], [\"SL\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Sierra Leone\\\">Sierra Leone</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Freetown\\\">Freetown</a>\", -13.2134, 8.4821, \"<a href=\\\"https://flagpedia.net/sl\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sl.webp\\\" alt=\\\"Flag of Sierra Leone\\\"></a>\"], [\"SV\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/El Salvador\\\">El Salvador</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/San Salvador\\\">San Salvador</a>\", -89.2073, 13.7034, \"<a href=\\\"https://flagpedia.net/sv\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sv.webp\\\" alt=\\\"Flag of El Salvador\\\"></a>\"], [\"SM\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/San Marino\\\">San Marino</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/San Marino\\\">San Marino</a>\", 12.4486, 43.9322, \"<a href=\\\"https://flagpedia.net/sm\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sm.webp\\\" alt=\\\"Flag of San Marino\\\"></a>\"], [\"SO\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Somalia\\\">Somalia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Mogadishu\\\">Mogadishu</a>\", 45.3254, 2.07515, \"<a href=\\\"https://flagpedia.net/so\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/so.webp\\\" alt=\\\"Flag of Somalia\\\"></a>\"], [\"RS\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Serbia\\\">Serbia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Belgrade\\\">Belgrade</a>\", 20.4656, 44.8024, \"<a href=\\\"https://flagpedia.net/rs\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/rs.webp\\\" alt=\\\"Flag of Serbia\\\"></a>\"], [\"SS\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/South Sudan\\\">South Sudan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Juba\\\">Juba</a>\", 31.6, 4.85, \"<a href=\\\"https://flagpedia.net/ss\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ss.webp\\\" alt=\\\"Flag of South Sudan\\\"></a>\"], [\"ST\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Sao Tome and Principe\\\">Sao Tome and Principe</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Sao Tome\\\">Sao Tome</a>\", 6.6071, 0.20618, \"<a href=\\\"https://flagpedia.net/st\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/st.webp\\\" alt=\\\"Flag of Sao Tome and Principe\\\"></a>\"], [\"SR\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Suriname\\\">Suriname</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Paramaribo\\\">Paramaribo</a>\", -55.1679, 5.8232, \"<a href=\\\"https://flagpedia.net/sr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sr.webp\\\" alt=\\\"Flag of Suriname\\\"></a>\"], [\"SK\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Slovak Republic\\\">Slovak Republic</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bratislava\\\">Bratislava</a>\", 17.1073, 48.1484, \"<a href=\\\"https://flagpedia.net/sk\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sk.webp\\\" alt=\\\"Flag of Slovak Republic\\\"></a>\"], [\"SI\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Slovenia\\\">Slovenia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Ljubljana\\\">Ljubljana</a>\", 14.5044, 46.0546, \"<a href=\\\"https://flagpedia.net/si\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/si.webp\\\" alt=\\\"Flag of Slovenia\\\"></a>\"], [\"SE\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Sweden\\\">Sweden</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Stockholm\\\">Stockholm</a>\", 18.0645, 59.3327, \"<a href=\\\"https://flagpedia.net/se\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/se.webp\\\" alt=\\\"Flag of Sweden\\\"></a>\"], [\"SZ\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Eswatini\\\">Eswatini</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Mbabane\\\">Mbabane</a>\", 31.4659, -26.5225, \"<a href=\\\"https://flagpedia.net/sz\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sz.webp\\\" alt=\\\"Flag of Eswatini\\\"></a>\"], [\"SC\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Seychelles\\\">Seychelles</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Victoria\\\">Victoria</a>\", 55.4466, -4.6309, \"<a href=\\\"https://flagpedia.net/sc\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sc.webp\\\" alt=\\\"Flag of Seychelles\\\"></a>\"], [\"SY\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Syrian Arab Republic\\\">Syrian Arab Republic</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Damascus\\\">Damascus</a>\", 36.3119, 33.5146, \"<a href=\\\"https://flagpedia.net/sy\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/sy.webp\\\" alt=\\\"Flag of Syrian Arab Republic\\\"></a>\"], [\"TC\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Turks and Caicos Islands\\\">Turks and Caicos Islands</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Grand Turk\\\">Grand Turk</a>\", -71.141389, 21.460278, \"<a href=\\\"https://flagpedia.net/tc\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/tc.webp\\\" alt=\\\"Flag of Turks and Caicos Islands\\\"></a>\"], [\"TD\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Chad\\\">Chad</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/N'Djamena\\\">N'Djamena</a>\", 15.0445, 12.1048, \"<a href=\\\"https://flagpedia.net/td\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/td.webp\\\" alt=\\\"Flag of Chad\\\"></a>\"], [\"TG\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Togo\\\">Togo</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Lome\\\">Lome</a>\", 1.2255, 6.1228, \"<a href=\\\"https://flagpedia.net/tg\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/tg.webp\\\" alt=\\\"Flag of Togo\\\"></a>\"], [\"TH\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Thailand\\\">Thailand</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Bangkok\\\">Bangkok</a>\", 100.521, 13.7308, \"<a href=\\\"https://flagpedia.net/th\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/th.webp\\\" alt=\\\"Flag of Thailand\\\"></a>\"], [\"TJ\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tajikistan\\\">Tajikistan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Dushanbe\\\">Dushanbe</a>\", 68.7864, 38.5878, \"<a href=\\\"https://flagpedia.net/tj\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/tj.webp\\\" alt=\\\"Flag of Tajikistan\\\"></a>\"], [\"TM\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Turkmenistan\\\">Turkmenistan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Ashgabat\\\">Ashgabat</a>\", 58.3794, 37.9509, \"<a href=\\\"https://flagpedia.net/tm\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/tm.webp\\\" alt=\\\"Flag of Turkmenistan\\\"></a>\"], [\"TL\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Timor-Leste\\\">Timor-Leste</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Dili\\\">Dili</a>\", 125.567, -8.56667, \"<a href=\\\"https://flagpedia.net/tl\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/tl.webp\\\" alt=\\\"Flag of Timor-Leste\\\"></a>\"], [\"TO\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tonga\\\">Tonga</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Nuku'alofa\\\">Nuku'alofa</a>\", -175.216, -21.136, \"<a href=\\\"https://flagpedia.net/to\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/to.webp\\\" alt=\\\"Flag of Tonga\\\"></a>\"], [\"TT\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Trinidad and Tobago\\\">Trinidad and Tobago</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Port-of-Spain\\\">Port-of-Spain</a>\", -61.4789, 10.6596, \"<a href=\\\"https://flagpedia.net/tt\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/tt.webp\\\" alt=\\\"Flag of Trinidad and Tobago\\\"></a>\"], [\"TN\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tunisia\\\">Tunisia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tunis\\\">Tunis</a>\", 10.21, 36.7899, \"<a href=\\\"https://flagpedia.net/tn\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/tn.webp\\\" alt=\\\"Flag of Tunisia\\\"></a>\"], [\"TR\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Turkey\\\">Turkey</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Ankara\\\">Ankara</a>\", 32.3606, 39.7153, \"<a href=\\\"https://flagpedia.net/tr\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/tr.webp\\\" alt=\\\"Flag of Turkey\\\"></a>\"], [\"TV\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tuvalu\\\">Tuvalu</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Funafuti\\\">Funafuti</a>\", 179.089567, -8.631488, \"<a href=\\\"https://flagpedia.net/tv\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/tv.webp\\\" alt=\\\"Flag of Tuvalu\\\"></a>\"], [\"TZ\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Tanzania\\\">Tanzania</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Dodoma\\\">Dodoma</a>\", 35.7382, -6.17486, \"<a href=\\\"https://flagpedia.net/tz\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/tz.webp\\\" alt=\\\"Flag of Tanzania\\\"></a>\"], [\"UG\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Uganda\\\">Uganda</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kampala\\\">Kampala</a>\", 32.5729, 0.314269, \"<a href=\\\"https://flagpedia.net/ug\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ug.webp\\\" alt=\\\"Flag of Uganda\\\"></a>\"], [\"UA\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Ukraine\\\">Ukraine</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kiev\\\">Kiev</a>\", 30.5038, 50.4536, \"<a href=\\\"https://flagpedia.net/ua\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ua.webp\\\" alt=\\\"Flag of Ukraine\\\"></a>\"], [\"UY\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Uruguay\\\">Uruguay</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Montevideo\\\">Montevideo</a>\", -56.0675, -34.8941, \"<a href=\\\"https://flagpedia.net/uy\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/uy.webp\\\" alt=\\\"Flag of Uruguay\\\"></a>\"], [\"US\", \"North America\", \"<a href=\\\"https://en.wikipedia.org/wiki/United States\\\">United States</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Washington D.C.\\\">Washington D.C.</a>\", -77.032, 38.8895, \"<a href=\\\"https://flagpedia.net/us\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/us.webp\\\" alt=\\\"Flag of United States\\\"></a>\"], [\"UZ\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Uzbekistan\\\">Uzbekistan</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Tashkent\\\">Tashkent</a>\", 69.269, 41.3052, \"<a href=\\\"https://flagpedia.net/uz\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/uz.webp\\\" alt=\\\"Flag of Uzbekistan\\\"></a>\"], [\"VC\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/St. Vincent and the Grenadines\\\">St. Vincent and the Grenadines</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kingstown\\\">Kingstown</a>\", -61.2653, 13.2035, \"<a href=\\\"https://flagpedia.net/vc\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/vc.webp\\\" alt=\\\"Flag of St. Vincent and the Grenadines\\\"></a>\"], [\"VE\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Venezuela, RB\\\">Venezuela, RB</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Caracas\\\">Caracas</a>\", -69.8371, 9.08165, \"<a href=\\\"https://flagpedia.net/ve\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ve.webp\\\" alt=\\\"Flag of Venezuela, RB\\\"></a>\"], [\"VG\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/British Virgin Islands\\\">British Virgin Islands</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Road Town\\\">Road Town</a>\", -64.623056, 18.431389, \"<a href=\\\"https://flagpedia.net/vg\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/vg.webp\\\" alt=\\\"Flag of British Virgin Islands\\\"></a>\"], [\"VI\", \"Latin America & Caribbean \", \"<a href=\\\"https://en.wikipedia.org/wiki/Virgin Islands (U.S.)\\\">Virgin Islands (U.S.)</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Charlotte Amalie\\\">Charlotte Amalie</a>\", -64.8963, 18.3358, \"<a href=\\\"https://flagpedia.net/vi\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/vi.webp\\\" alt=\\\"Flag of Virgin Islands (U.S.)\\\"></a>\"], [\"VN\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Vietnam\\\">Vietnam</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Hanoi\\\">Hanoi</a>\", 105.825, 21.0069, \"<a href=\\\"https://flagpedia.net/vn\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/vn.webp\\\" alt=\\\"Flag of Vietnam\\\"></a>\"], [\"VU\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Vanuatu\\\">Vanuatu</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Port-Vila\\\">Port-Vila</a>\", 168.321, -17.7404, \"<a href=\\\"https://flagpedia.net/vu\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/vu.webp\\\" alt=\\\"Flag of Vanuatu\\\"></a>\"], [\"WS\", \"East Asia & Pacific\", \"<a href=\\\"https://en.wikipedia.org/wiki/Samoa\\\">Samoa</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Apia\\\">Apia</a>\", -171.752, -13.8314, \"<a href=\\\"https://flagpedia.net/ws\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ws.webp\\\" alt=\\\"Flag of Samoa\\\"></a>\"], [\"XK\", \"Europe & Central Asia\", \"<a href=\\\"https://en.wikipedia.org/wiki/Kosovo\\\">Kosovo</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Pristina\\\">Pristina</a>\", 20.926, 42.565, \"<a href=\\\"https://flagpedia.net/xk\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/xk.webp\\\" alt=\\\"Flag of Kosovo\\\"></a>\"], [\"YE\", \"Middle East & North Africa\", \"<a href=\\\"https://en.wikipedia.org/wiki/Yemen, Rep.\\\">Yemen, Rep.</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Sana'a\\\">Sana'a</a>\", 44.2075, 15.352, \"<a href=\\\"https://flagpedia.net/ye\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/ye.webp\\\" alt=\\\"Flag of Yemen, Rep.\\\"></a>\"], [\"ZA\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/South Africa\\\">South Africa</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Pretoria\\\">Pretoria</a>\", 28.1871, -25.746, \"<a href=\\\"https://flagpedia.net/za\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/za.webp\\\" alt=\\\"Flag of South Africa\\\"></a>\"], [\"ZM\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Zambia\\\">Zambia</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Lusaka\\\">Lusaka</a>\", 28.2937, -15.3982, \"<a href=\\\"https://flagpedia.net/zm\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/zm.webp\\\" alt=\\\"Flag of Zambia\\\"></a>\"], [\"ZW\", \"Sub-Saharan Africa \", \"<a href=\\\"https://en.wikipedia.org/wiki/Zimbabwe\\\">Zimbabwe</a>\", \"<a href=\\\"https://en.wikipedia.org/wiki/Harare\\\">Harare</a>\", 31.0672, -17.8312, \"<a href=\\\"https://flagpedia.net/zw\\\"><img src=\\\"https://flagpedia.net/data/flags/h80/zw.webp\\\" alt=\\\"Flag of Zimbabwe\\\"></a>\"]];\n",
       "        // Display the table\n",
       "        $(document).ready(function () {\n",
       "            window.dataTablePromise.then(() => {\n",
       "                // Define the dt_args\n",
       "                let dt_args = {\"order\": []};\n",
       "                dt_args[\"data\"] = data;\n",
       "\n",
       "                \n",
       "                $('#b0e06eed-986f-42d8-b9de-6a3bda967805').DataTable(dt_args);\n",
       "            });\n",
       "        })\n",
       "    }\n",
       "</script>\n",
       "</div>\n"
      ],
      "text/plain": [
       "                          region  \\\n",
       "code                               \n",
       "AW    Latin America & Caribbean    \n",
       "AF                    South Asia   \n",
       "AO           Sub-Saharan Africa    \n",
       "AL         Europe & Central Asia   \n",
       "AD         Europe & Central Asia   \n",
       "...                          ...   \n",
       "XK         Europe & Central Asia   \n",
       "YE    Middle East & North Africa   \n",
       "ZA           Sub-Saharan Africa    \n",
       "ZM           Sub-Saharan Africa    \n",
       "ZW           Sub-Saharan Africa    \n",
       "\n",
       "                                                country  \\\n",
       "code                                                      \n",
       "AW    <a href=\"https://en.wikipedia.org/wiki/Aruba\">...   \n",
       "AF    <a href=\"https://en.wikipedia.org/wiki/Afghani...   \n",
       "AO    <a href=\"https://en.wikipedia.org/wiki/Angola\"...   \n",
       "AL    <a href=\"https://en.wikipedia.org/wiki/Albania...   \n",
       "AD    <a href=\"https://en.wikipedia.org/wiki/Andorra...   \n",
       "...                                                 ...   \n",
       "XK    <a href=\"https://en.wikipedia.org/wiki/Kosovo\"...   \n",
       "YE    <a href=\"https://en.wikipedia.org/wiki/Yemen, ...   \n",
       "ZA    <a href=\"https://en.wikipedia.org/wiki/South A...   \n",
       "ZM    <a href=\"https://en.wikipedia.org/wiki/Zambia\"...   \n",
       "ZW    <a href=\"https://en.wikipedia.org/wiki/Zimbabw...   \n",
       "\n",
       "                                                capital  longitude  latitude  \\\n",
       "code                                                                           \n",
       "AW    <a href=\"https://en.wikipedia.org/wiki/Oranjes...   -70.0167  12.51670   \n",
       "AF    <a href=\"https://en.wikipedia.org/wiki/Kabul\">...    69.1761  34.52280   \n",
       "AO    <a href=\"https://en.wikipedia.org/wiki/Luanda\"...    13.2420  -8.81155   \n",
       "AL    <a href=\"https://en.wikipedia.org/wiki/Tirane\"...    19.8172  41.33170   \n",
       "AD    <a href=\"https://en.wikipedia.org/wiki/Andorra...     1.5218  42.50750   \n",
       "...                                                 ...        ...       ...   \n",
       "XK    <a href=\"https://en.wikipedia.org/wiki/Pristin...    20.9260  42.56500   \n",
       "YE    <a href=\"https://en.wikipedia.org/wiki/Sana'a\"...    44.2075  15.35200   \n",
       "ZA    <a href=\"https://en.wikipedia.org/wiki/Pretori...    28.1871 -25.74600   \n",
       "ZM    <a href=\"https://en.wikipedia.org/wiki/Lusaka\"...    28.2937 -15.39820   \n",
       "ZW    <a href=\"https://en.wikipedia.org/wiki/Harare\"...    31.0672 -17.83120   \n",
       "\n",
       "                                                   flag  \n",
       "code                                                     \n",
       "AW    <a href=\"https://flagpedia.net/aw\"><img src=\"h...  \n",
       "AF    <a href=\"https://flagpedia.net/af\"><img src=\"h...  \n",
       "AO    <a href=\"https://flagpedia.net/ao\"><img src=\"h...  \n",
       "AL    <a href=\"https://flagpedia.net/al\"><img src=\"h...  \n",
       "AD    <a href=\"https://flagpedia.net/ad\"><img src=\"h...  \n",
       "...                                                 ...  \n",
       "XK    <a href=\"https://flagpedia.net/xk\"><img src=\"h...  \n",
       "YE    <a href=\"https://flagpedia.net/ye\"><img src=\"h...  \n",
       "ZA    <a href=\"https://flagpedia.net/za\"><img src=\"h...  \n",
       "ZM    <a href=\"https://flagpedia.net/zm\"><img src=\"h...  \n",
       "ZW    <a href=\"https://flagpedia.net/zw\"><img src=\"h...  \n",
       "\n",
       "[208 rows x 6 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_countries()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "itables",
   "language": "python",
   "name": "itables"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
